-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.ts
42 lines (31 loc) · 898 Bytes
/
gulpfile.ts
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
/* eslint-disable node/no-unpublished-import */
import gulp from "gulp";
import changed from "gulp-changed";
import minify from "gulp-minify";
/*
* Minify public/javascripts
*/
const publicJavascriptsDestination = "public/javascripts";
const publicJavascriptsMinFunction = () => {
return gulp.src("public-typescript/*.js", { allowEmpty: true })
.pipe(changed(publicJavascriptsDestination, {
extension: ".min.js"
}))
.pipe(minify({ noSource: true, ext: { min: ".min.js" } }))
.pipe(gulp.dest(publicJavascriptsDestination));
};
gulp.task("public-javascript-min", publicJavascriptsMinFunction);
/*
* Watch
*/
const watchFunction = () => {
gulp.watch("public-typescript/*.js", publicJavascriptsMinFunction);
};
gulp.task("watch", watchFunction);
/*
* Initialize default
*/
gulp.task("default", () => {
publicJavascriptsMinFunction();
watchFunction();
});