assets/gulpfile.txt
const { src, dest, watch, series, task } = require("gulp");
const sass = require("gulp-sass")(require("sass")); const csso = require("gulp-csso"); const rename = require("gulp-rename"); const sourcemaps = require("gulp-sourcemaps"); const buildStyles = () => { return src("scss/**/*.scss") .pipe(sourcemaps.init()) .pipe(sass({ sourceComments: false })) .pipe(sourcemaps.write('.')) .pipe(dest("dist/css")); }; const bundleStyles = () => { return src(["dist/css/**/*.css", "!dist/css/**/*.min.css"]) .pipe(csso()) .pipe(rename({ suffix: ".min" })) .pipe(dest("dist/css")); }; task('bundleStyles', bundleStyles); task('buildStyles', buildStyles); const watcher = () => { watch("scss/**/*.scss", series(buildStyles, bundleStyles)); }; exports.default = watcher; |