-
Notifications
You must be signed in to change notification settings - Fork 29
/
gulpfile.js
63 lines (54 loc) · 1.65 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
"use strict";
var gulp = require("gulp");
var r = require("gulp-load-plugins")();
var src = {
js: "src/*.coffee",
css: "src/*.scss"
};
var dest = "dist";
gulp.task("default", function() {
return gulp.start("js", "js-min", "css", "css-min");
});
gulp.task("watch", function() {
gulp.watch(src.js, ["js", "js-min"]);
gulp.watch(src.css, ["css", "css-min"]);
return gulp.start("default");
});
gulp.task("js", function() {
return gulp.src(src.js)
.pipe(r.sourcemaps.init())
.pipe(r.coffee())
.pipe(r.rename({suffix: "-latest"}))
.pipe(r.sourcemaps.write("./"))
.pipe(gulp.dest(dest));
});
gulp.task("js-min", function() {
return gulp.src(src.js)
.pipe(r.sourcemaps.init())
.pipe(r.coffee())
// Mangle will shorten variable names which breaks the AngularJS dependency injection.
// TODO: Use a build tool to preserve the important variables instead of disabling mangle.
.pipe(r.uglify({mangle: false}))
.pipe(r.rename({suffix: "-latest.min"}))
.pipe(r.sourcemaps.write("./"))
.pipe(gulp.dest(dest));
});
gulp.task("css", function() {
return gulp.src(src.css)
.pipe(r.rubySass())
.pipe(r.sourcemaps.init({loadMaps: true}))
.pipe(r.autoprefixer("last 2 versions", "ie >= 9", "Firefox ESR"))
.pipe(r.rename({suffix: "-latest"}))
.pipe(r.sourcemaps.write("./"))
.pipe(gulp.dest(dest));
});
gulp.task("css-min", function() {
return gulp.src(src.css)
.pipe(r.rubySass())
.pipe(r.sourcemaps.init({loadMaps: true}))
.pipe(r.autoprefixer("last 2 versions", "ie >= 9", "Firefox ESR"))
.pipe(r.minifyCss())
.pipe(r.rename({suffix: "-latest.min"}))
.pipe(r.sourcemaps.write("./"))
.pipe(gulp.dest(dest));
});