forked from reneolivo/es6-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gulpfile.js
60 lines (51 loc) · 1.31 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
var gulp = require("gulp");
var changed = require('gulp-changed');
var sourcemaps = require("gulp-sourcemaps");
var babel = require("gulp-babel");
var del = require("del");
var runSequence = require("run-sequence");
var app = {
source: "./src/**/*.js",
html: "./src/**/*.html",
css: "./src/**/*.css",
files: "./src/**/*.*",
dist: "./dist"
};
gulp.task("build-app", function () {
return gulp.src(app.source)
.pipe(sourcemaps.init())
.pipe(babel({modules: 'system'}))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(app.dist));
});
gulp.task("copy-html", function() {
return gulp.src(app.html)
.pipe(gulp.dest(app.dist));
});
gulp.task("copy-css", function() {
return gulp.src(app.css)
.pipe(gulp.dest(app.dist));
});
gulp.task("copy-everything", function() {
return gulp.src(app.files)
.pipe(gulp.dest(app.dist))
});
gulp.task("clean", function(callback) {
del([app.dist], callback);
});
gulp.task("build", function(callback) {
return runSequence(
'copy-everything',
"clean",
[ "build-app", "copy-html", "copy-css"],
callback
);
});
gulp.task("watch", function(callback) {
gulp.watch(app.source, ['build-app']);
gulp.watch(app.html, ['copy-html']);
gulp.watch(app.css, ['copy-css']);
});
gulp.task("default", function(callback) {
return runSequence("build");
});