Answer the question
In order to leave comments, you need to log in
Gulp 4 not updating CSS?
Hello!
I'm still a beginner, but there is a problem..
here is my gulp file:
const gulp = require('gulp');
const browserSync = require('browser-sync');
const sass = require('gulp-sass');
const cleanCSS = require('gulp-clean-css');
const autoprefixer = require('gulp-autoprefixer');
const rename = require("gulp-rename");
gulp.task('server', function() {
browserSync({
server: {
baseDir: "./"
}
});
gulp.watch("src/*.html").on('change', browserSync.reload);
});
gulp.task('styles', function() {
return gulp.src("src/sass/**/*.+(scss|sass)")
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(rename({suffix: '.min', prefix: ''}))
.pipe(autoprefixer())
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest("src/css"))
.pipe(browserSync.stream())
.pipe(browserSync.reload({stream: true}));
});
gulp.task('styles', function() {
return gulp.src("src/sass/**/*.+(scss|sass)")
.pipe(browserSync.reload({stream: true}));
});
gulp.task('watch', function() {
gulp.watch("src/sass/**/*.+(scss|sass)", gulp.parallel('styles'));
})
gulp.watch(['scripts/**/*.js','!scripts/main.min.js'], gulp.series(buildScripts, reload));
gulp.task('default', gulp.parallel('watch', 'server', 'styles'));
gulp.watch([settings.themeLocation + 'js/modules/*.js', settings.themeLocation + 'js/scripts.js'], gulp.series('waitForScripts', browserSync.reload));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question