-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
63 lines (51 loc) · 1.59 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
57
58
59
60
61
62
63
var gulp = require("gulp");
var LiveServer = require("gulp-live-server");
var browserSync = require("browser-sync");
var browserify = require("browserify");
var source = require("vinyl-source-stream");
var reactify = require("reactify");
gulp.task("live-server", function() {
browserSync.init({
server: {
baseDir: "./dist"
},
port: 8080
});
});
gulp.task('copyIndex', function() {
gulp.src('./app/index.html').pipe(gulp.dest('./dist'));
console.log("Copied index.html");
});
gulp.task('copyHtml', ['copyIndex'], function() {
gulp.src('.app/**/*.html').pipe(gulp.dest('./dist/html'));
console.log("Copied all html files");
});
gulp.task("copyCSS", function() {
gulp.src("./app/**/*.css").pipe(gulp.dest("./dist"));
console.log("Copied all css files");
});
gulp.task("copyImages", function() {
gulp.src("./app/img/*").pipe(gulp.dest("./dist/img"));
console.log("Copied all images files");
});
gulp.task('copy', ['copyHtml', 'copyCSS', 'copyImages'], function() {
console.log("Coping files is completed...");
});
gulp.task("bundle", ["copy"], function() {
return browserify({
entries: "./app/main.js",
debug: true
})
.transform(reactify)
.bundle()
.pipe(source("bundle.js"))
.pipe(gulp.dest("./dist"))
})
gulp.task("serve", ["bundle","live-server"], function() {
console.log("Server is running...");
});
gulp.task("watch", ["bundle"], browserSync.reload);
gulp.watch("./app/**/*.jsx", ["watch"]);
gulp.watch("./app/**/*.js", ["watch"]);
gulp.watch("./app/**/*.html", ["copyHtml"]);
gulp.watch("./app/**/*.css", ["copyCSS"]);