-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
75 lines (63 loc) · 1.93 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
const gulp = require("gulp");
const zip = require("gulp-zip");
const size = require("gulp-size");
const count = require("gulp-count");
const mocha = require("gulp-mocha");
const uglifyes = require("gulp-uglifyes");
const replace = require("gulp-replace");
const _package = require("./package.json");
var paths = {
mainjs: "src/js/ripe.js",
maincss: "src/css/ripe.css",
scripts: "src/js/**/*.js",
css: "src/css/**/*.css",
test: "test/js/**/*.js",
dist: "dist/**/*"
};
gulp.task("build-js", () => {
return gulp.src(paths.scripts)
.pipe(uglifyes({
mangle: false,
ecma: 6
}))
.pipe(replace("__VERSION__", _package.version))
.pipe(size())
.pipe(size({
gzip: true
}))
.pipe(gulp.dest("dist"))
.pipe(count("## js files copied"));
});
gulp.task("move-js", () => {
return gulp.src(paths.mainjs)
.pipe(gulp.dest("src/python/ripe_demo/static/js"));
});
gulp.task("move-css", () => {
return gulp.src(paths.maincss)
.pipe(gulp.dest("src/python/ripe_demo/static/css"));
});
gulp.task("compress", ["build-js"], () => {
return gulp.src(paths.dist)
.pipe(zip("dist.zip"))
.pipe(gulp.dest("build"));
});
gulp.task("mark", () => {
return gulp.src(paths.scripts)
.pipe(replace("__VERSION__", _package.version))
.pipe(gulp.dest("src/js"));
});
gulp.task("test", () => {
return gulp.src(paths.test)
.pipe(mocha({
reporter: "spec"
}));
});
gulp.task("watch-js", function() {
gulp.watch(paths.scripts, ["build-js", "move-js", "compress"]);
});
gulp.task("watch-css", function() {
gulp.watch(paths.css, ["move-css"]);
});
gulp.task("watch", ["build", "watch-js", "watch-css"]);
gulp.task("build", ["build-js", "move-js", "move-css", "compress"]);
gulp.task("default", ["build"]);