-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
46 lines (41 loc) · 1.03 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
const { dest, series, src, task } = require("gulp");
const babel = require("gulp-babel");
const watch = require("gulp-watch");
const rename = require("gulp-rename");
const babelOptions = {
minified: true,
comments: false,
compact: true,
shouldPrintComment: (val) => /@license/.test(val),
presets: [
["minify", {
mangle: {
keepClassName: true
}
}]
],
plugins: [
"@babel/plugin-syntax-import-assertions"
]
};
function si18n() {
return src("./src/si18n.js")
.pipe(dest("./"))
.pipe(dest("./website/"))
.pipe(babel(babelOptions))
.pipe(rename({ extname: ".min.js" }))
.pipe(dest("./website/"))
.pipe(dest("./"));
}
function demoScript() {
return src("./website/demo.js")
.pipe(babel(babelOptions))
.pipe(rename({ extname: ".min.js" }))
.pipe(dest("./website/"));
}
task("watch", () => {
const options = { ignoreInitial: false };
watch("./src/si18n.js", options, si18n);
watch("./website/*.js", options, demoScript);
});
task("default", series(si18n, demoScript));