lahmatiy / postcss-csso

PostCSS plugin to minify CSS using CSSO

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chaining in Grunt

thybzi opened this issue · comments

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)

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,

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.