gulpautoprefixerpostcssgulp-plugingulp-autoprefixer

What's the difference between using autoprefixer within gulp-postcss or outside of it?


I'm using Gulp and have used the Gulp Autoprefixer standalone such as:

gulp.task('styles', function() {
    gulp.src('scss/**/*.scss')
        //.................
        .pipe(sass())
        .pipe(autoprefixer({
            browsers: [
              //..........
            ],
        }))
        //............
});

...but then I see the Gulp Postcss plugin which seems to wrap the usage of a non-gulp autoprefixer such as:

gulp.task('styles', function() {
    gulp.src('scss/**/*.scss')
    //.................
            .pipe(sass())
            .pipe(postcss([
                autoprefixer({
                    browsers: [
                        //.......
                    ],
                }),
            ]))
    //............
});

What is the difference?


Solution

  • Autoprefixer is just a PostCSS plugin. There is no way to run it without PostCSS.

    gulp-autoprefixer hides PostCSS inside. Like a shortcut for gulp-postcss(autoprefixer). It is unofficial way to run Autoprefixer.

    Autoprefixer author recommends to use only gulp-postcss, because: