postcss / gulp-postcss

Pipe CSS through PostCSS processors with a single parse
MIT License
769 stars 65 forks source link

css.eachAtRule is not a function #133

Closed sfunaro closed 7 years ago

sfunaro commented 7 years ago

Hi! Trying to use postcss and I always get this error: gulp parse-css-dev [08:58:28] Using gulpfile ~/_Web/template-wp-2/gulpfile.js [08:58:28] Starting 'parse-css-dev'... [08:58:28] Finished 'parse-css-dev' after 10 ms

events.js:182 throw er; // Unhandled 'error' event ^ TypeError: css.eachAtRule is not a function at Processor.remove (/Users/stefane/_Web/template-wp-2/node_modules/autoprefixer-core/lib/processor.js:77:11) at Autoprefixer.postcss (/Users/stefane/_Web/template-wp-2/node_modules/autoprefixer-core/lib/autoprefixer.js:70:33) at /Users/stefane/_Web/template-wp-2/node_modules/autoprefixer-core/lib/autoprefixer.js:4:61 at LazyResult.run (/Users/stefane/_Web/template-wp-2/node_modules/postcss/lib/lazy-result.js:270:20) at LazyResult.asyncTick (/Users/stefane/_Web/template-wp-2/node_modules/postcss/lib/lazy-result.js:185:32) at LazyResult.asyncTick (/Users/stefane/_Web/template-wp-2/node_modules/postcss/lib/lazy-result.js:197:22) at LazyResult.asyncTick (/Users/stefane/_Web/template-wp-2/node_modules/postcss/lib/lazy-result.js:197:22) at LazyResult.asyncTick (/Users/stefane/_Web/template-wp-2/node_modules/postcss/lib/lazy-result.js:197:22) at LazyResult.asyncTick (/Users/stefane/_Web/template-wp-2/node_modules/postcss/lib/lazy-result.js:197:22) at LazyResult.asyncTick (/Users/stefane/_Web/template-wp-2/node_modules/postcss/lib/lazy-result.js:197:22)

The code is: ` var gulp = require('gulp'); var autoprefixer = require('autoprefixer'); var cssnext = require('postcss-cssnext'); var postcss = require('gulp-postcss');

gulp.task('parse-css-dev', function () { var plugins = [ cssnext, autoprefixer({browsers: ['last 2 versions']}) ]; return gulp.src("screen.css") .pipe(postcss(plugins)) .pipe(gulp.dest("./test")); });`

Versions (should be up to date): "gulp": "^3.9.1", "gulp-postcss": "^7.0.0", "postcss-cssnext": "^3.0.2", "autoprefixer": "^4.0.0", Node: v8.0.0 Gulp: 3.9.1

I tried using:

Is it my code or a problem with postcss ? Thanks!

TrySound commented 7 years ago

@sfunaro Looks like you use too old version of autoprefixer (currently 7).

sfunaro commented 7 years ago

Haaaa! I switched from gulp-autoprefixer to autoprefixer, without changing the version!!! THANKS!