-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
79 lines (73 loc) · 2.28 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
var gulp = require("gulp"),
ngAnnotate = require("gulp-ng-annotate"),
concat = require("gulp-concat"),
uglify = require("gulp-uglify"),
mc = require("gulp-minify-css"),
rename = require('gulp-rename'),
cssFileList = [
"css/bootstrap.css",
"css/main.css"
],
jsHelperFileList = [
"app/module/angular-local-storage.js",
"app/module/angular-sprintf.js",
"app/module/angular-filter-utils.js",
"app/directive/dxTree.js",
"app/helper/firebase.js",
"app/helper/utils.js"
],
jsFileList = [
"app/app.js",
"app/config/routes.js",
"app/config/localStorageServiceProvider.js",
"app/config/constant.js",
"app/directive/crtNewsItem.js",
"app/controller/HackerNewsController.js",
"app/controller/NavbarController.js",
"app/controller/StoryController.js",
"app/service/HackerNewsAPI.js",
"app/service/NavbarService.js",
"app/service/HackerNewsListService.js"
],
jsWorkerFileList = [
"app/worker/removeExcessItems.js"
];
gulp.task("compressCss", function () {
return gulp
.src(cssFileList)
.pipe(concat("styles.min.css"))
.pipe(mc())
.pipe(gulp.dest("css"));
});
gulp.task("compressHelpersJs", function () {
return gulp
.src(jsHelperFileList)
.pipe(ngAnnotate())
.pipe(concat("CRT-helpers.min.js"))
.pipe(uglify())
.pipe(gulp.dest("app/helper"));
});
gulp.task("compressJs", function () {
return gulp
.src(jsFileList)
.pipe(ngAnnotate())
.pipe(concat("CRT-app.min.js"))
.pipe(uglify())
.pipe(gulp.dest("app"));
});
gulp.task("compressWorkersJs", function () {
return gulp
.src(jsWorkerFileList)
.pipe(uglify())
.pipe(rename({suffix: ".min"}))
.pipe(gulp.dest("app/worker"));
});
// manually run all tasks
gulp.task("default", ["compressCss", "compressHelpersJs", "compressWorkersJs", "compressJs"]);
// run a watch function for the tasks
gulp.task('watch', function () {
gulp.watch(cssFileList, ["compressCss"]);
gulp.watch(jsHelperFileList, ["compressHelpersJs"]);
gulp.watch(jsFileList, ["compressJs"]);
gulp.watch(jsWorkerFileList, ["compressWorkersJs"]);
});