-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.babel.js
46 lines (41 loc) · 1.1 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
import gulp from "gulp";
import babel from "gulp-babel";
import uglify from "gulp-uglify";
import rename from "gulp-rename";
import mochaPhantomJS from "gulp-mocha-phantomjs";
gulp.task("default", ["build"]);
gulp.task("build", ["babel"], () => {
return gulp.src([
"src/*.js",
"!src/*.min.js"
])
.pipe(uglify({
preserveComments: "license",
wrap: true // to prevent Babel's helpers from being exported as globals
}))
.pipe(rename({
suffix: ".min"
}))
.pipe(gulp.dest("src"));
});
gulp.task("babel", () => {
return gulp.src("src/*.es6")
.pipe(babel())
.pipe(gulp.dest("src"));
});
gulp.task("babel:test", () => {
return gulp.src("test/units/*.es6")
.pipe(babel())
.pipe(gulp.dest("test/units"));
});
gulp.task("test", ["babel:test"], () => {
return gulp.src("test/index.html")
.pipe(mochaPhantomJS({
phantomjs: {
useColors: true
}
}))
.on("error", () => {
gulp.emit("end");
});
});