-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
43 lines (38 loc) · 1.19 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
var gulp = require("gulp"),
plugins = require("gulp-load-plugins")(),
pkg = require("./package.json"),
paths = {
src: {
css: "./src/main/resources/static/sass"
},
dist: {
css: "./src/main/resources/static/css"
}
},
config = {
autoprefixer: {
browsers: ["last 2 versions", "> 1%"]
}
};
// Build the Sass
gulp.task("build:css", function() {
return gulp.src(paths.src.css + "/*")
// Prevents Sass from hanging on errors (syntax error, etc.)
.pipe(plugins.plumber())
.pipe(plugins.sourcemaps.init())
// Need to use sass.sync() to work with Plumber correctly
.pipe(plugins.sass.sync())
.pipe(plugins.autoprefixer(config.autoprefixer))
.pipe(plugins.sourcemaps.write("./"))
.pipe(gulp.dest(paths.dist.css));
});
// Clean the Sass build directory
gulp.task("clean:css", function() {
return gulp.src(paths.dist.css, { read: false })
.pipe(plugins.clean());
})
gulp.task("build", ["build:css"]);
gulp.task("clean", ["clean:css"]);
gulp.task("watch", function() {
gulp.watch(paths.src.css + "/**/*", ["build:css"]);
});