postcss / postcss-simple-vars

PostCSS plugin for Sass-like variables
MIT License
415 stars 36 forks source link

Please provide better error handling #32

Closed jithine closed 8 years ago

jithine commented 8 years ago

I had a variable used which was not defined $inactiveText: $grey;

$grey was not defined and this causes postcss to just ignore all css files which depends on this rule. No error/warning is thrown which makes it difficult to figure out what is happening.

ai commented 8 years ago

@jithin1987 if you are not set silent or unknow option, plugin should raise a error: https://github.com/postcss/postcss-simple-vars/blob/master/test/test.js#L66-L70

Beacuse you said that files was ignored, I think it if build tool issue, when it catch and hide all errors from PostCSS.

What build tool are you use and what config you set?

jithine commented 8 years ago

I am using grunt-postcss for build. This is my config

    postcss: {
      options: {
        failOnError: true,
        processors: [
          require('postcss-import'),
          require('postcss-nested')(),
          require('postcss-simple-vars')({variables: require('css-vars')}),
          require('postcss-extend')(),
          require('autoprefixer')({browsers: 'last 2 versions'})
        ]
      },
      dist: {
        files: [{
          expand: true,
          ext: '.css',
          dest: 'dist/',
          src: ['css/*.css']
        }]
      }
    },

Output when there is an error as I described in description

> grunt postcss
Running "postcss:dist" (postcss) task
>> 1 processed stylesheet created.

Done, without errors.

Output when there is no error

> grunt postcss
Running "postcss:dist" (postcss) task
>> 7 processed stylesheets created.

Done, without errors.

When there is an error files are just not processed, leading to long debug times. That number is easy to miss.

ai commented 8 years ago

@nDmitry can you help here? Seems like grunt-postcss hides some errors.

ai commented 8 years ago

Do it issue releated? https://github.com/nDmitry/grunt-postcss/issues/70

nDmitry commented 8 years ago

@ai should be fixed in 0.7.1.

jithine commented 8 years ago

Thanks a lot @nDmitry. The I see proper failure now.