-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
37 lines (31 loc) · 854 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
37
var gulp = require("gulp"),
gulpIf = require("gulp-if"),
gulpCopy = require("gulp-copy");
var useref = require("gulp-useref"),
uglify = require("gulp-uglify"),
sourcemaps = require("gulp-sourcemaps"),
lazypipe = require("lazypipe");
var webserver = require("gulp-webserver");
gulp.task("serve", function() {
gulp.src(".").pipe(webserver({}));
});
gulp.task("useref", function() {
return gulp
.src("index.html")
.pipe(
useref(
{},
lazypipe().pipe(
sourcemaps.init,
{ loadMaps: true }
)
)
)
.pipe(gulpIf("js/*.js", uglify()))
.pipe(gulpIf("js/*.js", sourcemaps.write(".")))
.pipe(gulp.dest("dist"));
});
gulp.task("copyImages", function() {
return gulp.src(["images/**/*.png"]).pipe(gulpCopy("dist"));
});
gulp.task("default", ["copyImages", "useref"]);