forked from giventofly/pixelit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
36 lines (33 loc) · 1.01 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
const gulp = require("gulp");
const uglify = require("gulp-uglify-es").default;
//const concat = require("gulp-concat");
const babel = require("gulp-babel");
const rename = require("gulp-rename");
gulp.task("servejs", function () {
//*** direct copy
gulp.src(["src/main.js","src/tests.js"]).pipe(gulp.dest("docs/js/"));
gulp.src("src/pixelit.js").pipe(gulp.dest("dist/"));
//*** minify and transpile
gulp
.src("src/main.js")
.pipe(babel({ presets: ["@babel/env"] }))
.pipe(uglify())
.pipe(rename("main.min.js"))
.pipe(gulp.dest("docs/js/"));
gulp
.src("dist/pixelit.min.js")
.pipe(gulp.dest("docs/js/"));
return gulp
.src("src/pixelit.js")
.pipe(babel({ presets: ["@babel/env"] }))
.pipe(uglify())
.pipe(rename("pixelit.min.js"))
.pipe(gulp.dest("dist/"));
});
const serve = gulp.series(["servejs"]);
//live and dist task
gulp.task("serve", function () {
console.log(`Watching src/*.js ...`);
serve();
return gulp.watch("src/*.js", gulp.series("servejs"));
});