Autoprefixer won't add or remove prefixes

812 Views Asked by At

I have the following in my gulpfile, and CSS gets compiled, but prefixes are not added or removed. What am I doing wrong?

// The task
// --------

gulp.task('autoprefix', function () {
  var prefixr = autoprefixer({
    browsers: ['last 2 versions', 'IE >=9'],
    remove: true,
    add: true
  });
  return gulp.src('app/styles/*.css')
    .pipe(postcss([ prefixr ]))
    .pipe(gulp.dest('app/styles'));
});


// Run watch
// --------

gulp.task('watch', function() {
  gulp.watch('app/styles/**/*.less', { interval: 1000 }, ['less', 'autoprefix']);
});
1

There are 1 best solutions below

0
On

I had the same problem. But I think it all lies in your css file (or less for that matter). I posted an issue in their github repo here: https://github.com/postcss/autoprefixer/issues/564

And we talked back and forth only to find out that the problem was on my css (was also using stylus).

A quick test, make a newer css file, with just this simple rule.

html {
   display flex
}

Then run it and see, if it gets prefixed!

If not, take a look if other plugins work (like csswring) And I hope you are using autoprefixer and not the autoprefixer-core.