Answer the question
In order to leave comments, you need to log in
Gulpfile.js doesn't work watch, what's wrong?
I compile scss to css using Gulp. Everything was great, but when I started a new project, I found that the Gulpfile.js code, which worked from project to project, stopped working.
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
gulp.task('sass', function () {
gulp.src('./assets/scss/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(sass({outputStyle: 'compressed'}))
.pipe(autoprefixer({
browsers: ["last 50 versions", "ie >= 9"],
cascade: false
}))
.pipe(gulp.dest('./assets/css'))
});
gulp.task('watch', function () {
gulp.watch('./assets/scss/*.scss', ['sass']);
});
The following tasks did not complete: sass
Did you forget to signal async completion?.
Answer the question
In order to leave comments, you need to log in
The fourth version introduced a syntax that allows you to specify the order in which tasks are started.
Try like this.
gulp.task('watch', function() {
gulp.watch('./assets/scss/*.scss', gulp.series('sass'));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question