-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
gulpfile.js
64 lines (59 loc) · 1.57 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Sass configuration
const gulp = require("gulp");
// const sass = require("gulp-sass");
// const plumber = require("gulp-plumber");
const workboxBuild = require("workbox-build");
const del = require("del");
const packageJSON = require("./package.json");
const echomdVersion = packageJSON.dependencies["@0xgg/echomd"];
//const src = "./public/styles/**/*.scss";
/*
gulp.task("sass", function (cb) {
gulp
.src(src)
.pipe(plumber())
.pipe(sass())
.pipe(
gulp.dest(function (f) {
return f.base;
}),
);
cb();
});
gulp.task(
"default",
gulp.series("sass", function (cb) {
gulp.watch(src, gulp.series("sass"));
cb();
}),
);
gulp.task(
"build",
gulp.series("sass", function (cb) {
cb();
}),
);
*/
gulp.task("copy-css-files", function (cb) {
del.sync(`./public/styles/echomd*`);
gulp
.src(["./node_modules/@0xgg/echomd/theme/**/*"])
.pipe(gulp.dest(`./public/styles/echomd@${echomdVersion}/`));
cb();
});
gulp.task("service-worker", () => {
return workboxBuild
.injectManifest({
swSrc: "src/sw.js",
swDest: "build/service-worker.js",
globDirectory: "build",
globPatterns: ["**/*.{js,css,html,png,svg,woff2}"], // We ignore eot,ttf,woff and only support woff2 font
globIgnores: ["assets/apple-*"],
maximumFileSizeToCacheInBytes: 1024 * 1024 * 8, // 8mb
})
.then(({ count, size, warnings }) => {
// Optionally, log any warnings and details.
warnings.forEach(console.warn);
console.log(`${count} files will be precached, totaling ${size} bytes.`);
});
});