Hi Jason thanks for your quick reply. I have installed gulp-clean-css as you recommended. I have tried adding it to my gulpfile.js but the CSS isn’t minifying?
Can this also work with watch?
This is how my gulpfile.js looks like -
const gulp = require('gulp');
const sass = require('gulp-sass');
const cleanCSS = require('gulp-clean-css');
const browserSync = require('browser-sync').create();
//compile scss into css
function style(){
//where is my scss file
return gulp.src('./scss/**/*.scss')
//pass that file through sass compiler
.pipe(sass())
//cleanCSS minify
.pipe(cleanCSS())
//where do I save compiled css
.pipe(gulp.dest('./css'))
//stream changes to all browsers
.pipe(browserSync.stream());
}
function watch(){
browserSync.init({
proxy: 'local.testsite.com',
files: [
'./**/*.php'
]
});
gulp.watch('./scss/**/*.scss', style)
gulp.watch('./*.html').on('change', browserSync.reload);
gulp.watch('./*.php').on('change', browserSync.reload);
gulp.watch('./js/**/*.js').on('change', browserSync.reload);
}
exports.style = style;
exports.watch = watch;
The instructions on the package page still uses task? Should I use this with gulp v4?