lahmatiy / postcss-csso

PostCSS plugin to minify CSS using CSSO
MIT License
119 stars 6 forks source link

Chaining in Grunt #5

Closed thybzi closed 8 years ago

thybzi commented 8 years ago

I have the following chain in my Gruntfile.js

        postcss: {
            files: { /* path here */ },
            options: {
                processors: [
                    require('postcss-url')({ /* options here */ }),
                    require('autoprefixer')({ /* options here */ }),
                    require('postcss-csso')()
                ]
            }
        }

After adding require('postcss-csso')() line, I always get this error:

[TypeError: error.setMessage is not a function]

(In comparison, when adding require('cssnano')(), everything is compiled without errors)

thybzi commented 8 years ago

Update: seems like this happens when there is CSS parsing error Running plain csso on the same .css file outputs:

Parse error C:\repo\titr\web\css\desktop.css: Unexpected input
  716 |.image-flow .items > li {
  717 |  height: 440px;
  718 |  margin-bottom: $figure-cite-line-height;
------------------------^
  719 |}
  720 |.image-flow .items > li,
pepelsbey commented 8 years ago

I have the same error message caused by .2048-puzzle class name:

$ gulp styles
[02:04:27] Using gulpfile gulpfile.js
[02:04:27] Starting 'styles'...
[TypeError: error.setMessage is not a function]

But when I fix it .puzzle-2048 error goes away. I guess errors should be handled in a better way.