Answer the question
In order to leave comments, you need to log in
Why watch task doesn't compile gulp 4 css?
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserSync = require('browser-sync'),
concat = require('gulp-concat'),
uglify = require('gulp- uglifyjs');
gulp.task('sass', function() {
return gulp.src('app/sass/**/*.sass')
.pipe(sass())
.pipe(gulp.dest('app/css') )
.pipe(browserSync.reload({stream:true}));
});
gulp.task('browser-sync', function(){
browserSync({
server: {
baseDir:'app'
},
notify:false
});
});
gulp.task('scripts',
'app/libs/jquery/dist/jquery.min.js',
'app/libs/magnific-popup/dist/jquery.magnific-popup.min.js',
])
.pipe(concat('libs.min. js'))
.pipe(uglify())
.pipe(gulp.dest('app/js'));
});
gulp.task('watch', gulp.parallel('browser-sync','sass', 'scripts'), function(){
gulp.watch('app/sass/**/*.sass', gulp. parallel('sass'));
gulp.watch('app/**/*.html');
gulp.watch('app/js/**/*.js');
});
Answer the question
In order to leave comments, you need to log in
browserSync = require('browser-sync').create() like so
.pipe(sass({outputStyle: 'compressed'}) like so too
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question