-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgulpfile.js
56 lines (50 loc) · 1.13 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
const gulp = require("gulp");
const connect = require("gulp-connect");
const eslint = require("gulp-eslint");
const babel = require("gulp-babel");
const minify = require("gulp-minify");
const serveStatic = require("serve-static");
gulp.task("lint", function() {
return gulp
.src(["./src/*.js"])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task("js", function() {
gulp.src("./src/*.js").pipe(connect.reload());
});
gulp.task("connect", function() {
connect.server({
root: "./",
livereload: true,
port: 8888,
middleware: function(connect) {
return [
connect().use("/bower_components", serveStatic("bower_components"))
];
}
});
});
gulp.task("watch", function() {
gulp.watch(["./src/*.js"], ["lint", "js"]);
});
gulp.task("build", function() {
return gulp
.src("src/polygonize.js")
.pipe(
babel({
presets: ["es2015"]
})
)
.pipe(
minify({
ext: {
src: ".js",
min: ".min.js"
}
})
)
.pipe(gulp.dest("dist"));
});
gulp.task("default", ["connect", "lint", "watch"]);