-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.ts
70 lines (56 loc) · 1.81 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* eslint-disable node/no-unpublished-import */
import gulp from "gulp";
import minify from "gulp-minify";
import concat from "gulp-concat";
/*
* Minify public/javascripts
*/
const adminJavascriptFunction = () => {
return gulp.src([
"public-typescript/admin/main.js",
"public-typescript/admin/users.js",
"public-typescript/admin/recordTypes.js",
"public-typescript/admin/statusTypes.js",
"public-typescript/admin/recordUserTypes.js",
"public-typescript/admin/tableCleanup.js"
], { allowEmpty: true })
.pipe(concat("admin.js"))
.pipe(minify({ noSource: true, ext: { min: ".min.js" } }))
.pipe(gulp.dest("public/javascripts"));
};
const editJavascriptFunction = () => {
return gulp.src([
"public-typescript/edit/main.js",
"public-typescript/edit/recordStatuses.js",
"public-typescript/edit/recordUsers.js",
"public-typescript/edit/recordURLs.js",
"public-typescript/edit/relatedRecords.js",
"public-typescript/edit/recordComments.js"
], { allowEmpty: true })
.pipe(concat("edit.js"))
.pipe(minify({ noSource: true, ext: { min: ".min.js" } }))
.pipe(gulp.dest("public/javascripts"));
};
const mainJavascriptFunction = () => {
return gulp.src("public-typescript/*.js", { allowEmpty: true })
.pipe(minify({ noSource: true, ext: { min: ".min.js" } }))
.pipe(gulp.dest("public/javascripts"));
};
/*
* Watch
*/
const watchFunction = () => {
gulp.watch("public-typescript/*.js", mainJavascriptFunction);
gulp.watch("public-typescript/admin/*.js", adminJavascriptFunction);
gulp.watch("public-typescript/edit/*.js", editJavascriptFunction);
};
gulp.task("watch", watchFunction);
/*
* Initialize default
*/
gulp.task("default", () => {
mainJavascriptFunction();
adminJavascriptFunction();
editJavascriptFunction();
watchFunction();
});