Answer the question
In order to leave comments, you need to log in
Gulp throws an error when including an autoprefixer. What is the problem?
I'm trying to run. Gives an error message. I can not understand what she refers to? Google did not help.
The code itself
const gulp = require("gulp");
const sass = require("gulp-sass");
const less = require("gulp-less");
const stylus = require("gulp-stylus");
const sourcemaps = require("gulp-sourcemaps");
const autoprefixer = require("gulp-autoprefixer");
//sass
gulp.task('sasS', function() {
return gulp.src('./scss/*.scss')
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./css/'))
});
//less
gulp.task('lesS', function() {
return gulp.src('./less/*.less')
.pipe(sourcemaps.init())
.pipe(less())
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./css/'))
});
//stylus
gulp.task('stylusS', function() {
return gulp.src('./stylus/*.styl')
.pipe(sourcemaps.init())
.pipe(stylus())
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./css/'))
});
gulp.task('default', gulp.parallel('sasS', 'lesS', 'stylusS'));
Answer the question
In order to leave comments, you need to log in
if I'm not mistaken, when I was using version 3 of gulp, the gulp-autoprefixer plugin recommended removing (moving to package.json) the property "browsers: ['last 2 versions']" , maybe in 4 it already causes an error. Try to reschedule. I'll add a screenshot for clarity.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question