-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
43 lines (31 loc) · 1.47 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
/* eslint-disable require-jsdoc, no-console */
const { src, dest, series } = require('gulp');
const del = require("del");
const replace = require("gulp-replace");
const displayModes = ["fullscreen", "standalone", "minimal-ui", "browser"];
const cleanDist = () => del(["dist/**", "!dist"]);
const copy = (source, destination) => src(source).pipe(dest(destination));
function generate(done) {
const templateTasks = displayModes.map(mode => {
return () => src("src/template/*.*").pipe(replace("{display_mode}", mode)).pipe(dest(`dist/${mode}/`));
});
const scriptsTasks = displayModes.map(mode => {
return () => copy("src/template/scripts/*.js", `dist/${mode}/scripts/`);
});
const styleTasks = displayModes.map(mode => {
return () => copy("src/template/styles/*.css", `dist/${mode}/styles/`);
});
const manifestImageTasks = displayModes.map(mode => {
return () => copy(`src/template/images/manifest/${mode}/*.png`, `dist/${mode}/images/manifest/`);
});
const iconTasks = displayModes.map(mode => {
return () => copy("src/template/images/icons/*", `dist/${mode}/images/icons/`);
});
const commonTask = () => copy(["src/*", "!src/template"], "dist/");
const tasks = [...templateTasks, ...scriptsTasks, ...styleTasks, ...manifestImageTasks, ...iconTasks, commonTask];
return series(...tasks, seriesDone => {
seriesDone();
done();
})();
}
exports.default = series(cleanDist, generate);