-
Notifications
You must be signed in to change notification settings - Fork 17
/
gulpfile.babel.js
54 lines (49 loc) · 1.06 KB
/
gulpfile.babel.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
const gulp = require("gulp");
const concat = require("gulp-concat");
const uglify = require("gulp-uglify");
const babel = require("gulp-babel");
const header = require("gulp-header");
const pkg = require("./package.json");
const connect = require("gulp-connect");
const banner = [
"/*! ",
"<%= package.name %> ",
"v<%= package.version %> | ",
"(c) " + new Date().getFullYear() + " <%= package.author %> |",
" <%= package.homepage %>",
" */",
"\n"
].join("");
gulp.task("js", () => {
return gulp
.src("src/*.js")
.pipe(
babel({
presets: ["@babel/env"]
})
)
.pipe(concat("poster.js"))
.pipe(
header(banner, {
package: pkg
})
)
.pipe(gulp.dest("dist/"))
.pipe(uglify())
.pipe(concat("poster.min.js"))
.pipe(
header(banner, {
package: pkg
})
)
.pipe(gulp.dest("dist/"));
});
gulp.task("server", function() {
connect.server({
port: 8080,
});
});
gulp.watch("src/**/*.js", function(e) {
gulp.start("js");
});
gulp.task("default", ["js", 'server']);