-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
46 lines (37 loc) · 1.08 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 gulp = require("gulp");
const exec = require("child_process").exec;
const clean = require("gulp-clean");
const concat = require("gulp-concat");
const rename = require("gulp-rename");
const uglify = require("gulp-uglify");
const srcFiles = "./src/*.js";
const tempFile = "./concant.js";
const destFile = "./Code.js";
const GulpIt = () => {
return gulp
.src(srcFiles)
.pipe(concat(tempFile))
.pipe(gulp.dest("."))
.pipe(rename(destFile))
.pipe(uglify())
.pipe(gulp.dest("."));
};
const CleanIt = () => {
return gulp.src(tempFile).pipe(clean());
};
const UpdateIt = cb => {
exec("clasp push", (err, stdout, stderr) => {
console.log("= clasp: output ==========================\n");
if (stdout) {
console.log("stdout", stdout);
}
if (stderr) {
console.log("stderr", stderr);
}
console.log("==========================================");
cb(err); // err should be `null` if everything goes right
});
};
exports.default = () => {
return gulp.watch(["./src/*.js","./*.html"], gulp.series(GulpIt, CleanIt, UpdateIt));
};