-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·36 lines (32 loc) · 949 Bytes
/
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
var babelify = require("babelify");
var gulp = require("gulp");
var gulpLiveServer = require("gulp-live-server");
var rename = require('gulp-rename');
var browserify = require("browserify");
var source = require("vinyl-source-stream");
gulp.task("build", ["copyHTMLFiles", "bundleJSFiles", "startServer"]);
gulp.task("copyHTMLFiles", function() {
return gulp.src([
"src/html/main.html",
"src/html/main.css"
])
.pipe(rename(function(path) {
path.basename = "index";
}))
.pipe(gulp.dest("build"));
});
gulp.task("bundleJSFiles", ["copyHTMLFiles"], function() {
return browserify({
entries: "src/html/main.js"
})
.transform(babelify.configure({
presets : ["es2015", "react"]
}))
.bundle()
.pipe(source("app.js"))
.pipe(gulp.dest("build"));
});
gulp.task("startServer", ["copyHTMLFiles", "bundleJSFiles"], function() {
const server = gulpLiveServer("server.js", undefined, false);
server.start();
});