-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
34 lines (28 loc) · 1.04 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const { src, dest, watch, series, parallel } = require("gulp"); // Import 'parallel'
const sass = require("gulp-sass")(require("sass"));
const cssnano = require("gulp-cssnano");
const rename = require("gulp-rename");
const fs = require("fs");
const path = require("path");
function clean() {
// Define the path to the 'css' folder
const cssFolderPath = path.join(__dirname, "css");
// Check if the 'css' folder exists
if (fs.existsSync(cssFolderPath)) {
// Use the 'fs' module to remove the 'css' folder and its contents
fs.rmSync(cssFolderPath, { recursive: true });
}
return Promise.resolve(); // Return a resolved Promise to signal task completion
}
function buildStyles() {
return src("flexistyles/flexistyles.scss")
.pipe(sass())
.pipe(dest("css"))
.pipe(cssnano()) // Minify immediately after building
.pipe(rename({ suffix: ".min" }))
.pipe(dest("css"));
}
function watchTask() {
watch(["flexistyles/**/*.scss"], buildStyles);
}
exports.default = series(clean, buildStyles, watchTask); // Use 'parallel'