-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
60 lines (56 loc) · 1.6 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"),
plugins = require("gulp-load-plugins")(),
pkg = require("./package.json"),
config = {
banners: {
full: [
"/*!",
" * <%= pkg.name %> v<%= pkg.version %> - <%= pkg.description %>",
" * On the web at <%= pkg.homepage %>",
" * Written by <%= pkg.author %>",
" * Licensed under <%= pkg.license %>",
" */",
""
].join("\n"),
min: [
"/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> License | <%= pkg.homepage %> */",
""
].join("\n")
},
autoprefixer: {
browsers: ["last 2 versions", "> 1%"]
},
csso: {
comments: false,
restructure: false
},
sass: {
outputStyle: "expanded"
}
};
// SCSS, autoprefix, and minify src/
gulp.task("build", ["clean"], function() {
return gulp
.src("src/*.scss")
.pipe(plugins.plumber())
.pipe(plugins.sass(config.sass))
.pipe(plugins.autoprefixer(config.autoprefixer))
.pipe(plugins.header(config.banners.full, { pkg: pkg }))
.pipe(gulp.dest("dist/"))
.pipe(plugins.csso(config.csso))
.pipe(plugins.rename({ suffix: ".min" }))
.pipe(plugins.header(config.banners.min, { pkg: pkg }))
.pipe(gulp.dest("dist/"));
});
// watch for changes and rebuild CSS
gulp.task("watch", function() {
gulp.watch("src/*.scss", ["build"]);
});
// clean dist/
gulp.task("clean", function() {
return gulp
.src("dist", { read: false })
.pipe(plugins.clean());
});
// Set default task
gulp.task("default", ["watch"]);