anandthakker / doiuse

:bomb: Lint CSS for browser support against caniuse database.
MIT License
1.24k stars 51 forks source link

Make doiuse to work with gulp #22

Closed kl3ryk closed 8 years ago

kl3ryk commented 8 years ago

I have defined the following task:

var gulp = require("gulp");
var gulpPostCss = require('gulp-postcss');
var doiuse = require('doiuse');

gulp.task("doiuse", function () {
    gulp.src("./css/**/*.css")
        .pipe(gulpPostCss([
            doiuse({
                browsers: [
                    'ie >= 8',
                    '> 1%'
                ],
                onFeatureUsage: function (usageInfo) {
                    console.log(usageInfo.message);
                }
            })
        ]));
});

And when i run it i have the following result:

events.js:141
throw er; // Unhandled 'error' event
^
TypeError: css.prevMap.consumer is not a function
at __MY_DIR__\node_modules\doiuse\lib\doiuse.js:38:30
at Detector.decl (__MY_DIR__\node_modules\doiuse\lib\detect-feature-use.js:61:13)
at __MY_DIR__\node_modules\doiuse\lib\detect-feature-use.js:103:18
at Rule.each (__MY_DIR__\node_modules\gulp-postcss\node_modules\postcss\lib\container.js:59:22)
at Detector.process (__MY_DIR__\node_modules\doiuse\lib\detect-feature-use.js:97:12)
at Detector.rule (__MY_DIR__\node_modules\doiuse\lib\detect-feature-use.js:76:12)
at __MY_DIR__\node_modules\doiuse\lib\detect-feature-use.js:100:18
at Root.each (__MY_DIR__\node_modules\gulp-postcss\node_modules\postcss\lib\container.js:59:22)
at Detector.process (__MY_DIR__\node_modules\doiuse\lib\detect-feature-use.js:97:12)
at postcss (__MY_DIR__\node_modules\doiuse\lib\doiuse.js:32:23)

Process finished with exit code 1

Software versions:

node -v
v4.1.2

npm -v
3.3.5
anandthakker commented 8 years ago

Thanks for the report @kl3ryk - Just updated the postcss api - can you check if 1.0.4 fixes this for you?

kl3ryk commented 8 years ago

Yes now everything is working ok :) - thanks