-
Notifications
You must be signed in to change notification settings - Fork 208
/
gulpfile.js
56 lines (49 loc) · 1.41 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
"use strict";
var gulp = require("gulp");
var sass = require("gulp-sass");
var postcss = require("gulp-postcss");
var sourcemaps = require("gulp-sourcemaps");
var autoprefixer = require("autoprefixer");
var reveasy = require("gulp-rev-easy");
var path = require("path");
var concat = require("gulp-concat");
var uglify = require("gulp-uglify");
var plugins = [autoprefixer({ browsers: ["last 1 version"] })];
gulp.task("default", ["sass", "scripts"], function() {
gulp.watch("./source/sass/**/*.scss", ["sass"]);
gulp.watch("./source/js/**/*.js", ["scripts"]);
});
gulp.task("sass", function() {
return gulp
.src("./source/sass/**/*.scss")
.pipe(sourcemaps.init())
.pipe(sass({ outputStyle: "compressed" }).on("error", sass.logError))
.pipe(postcss(plugins))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest("./source/css"));
});
gulp.task("scripts", function() {
var files = [
"./source/js/fastclick.js",
"./source/js/scroll-spy.js",
"./source/js/zenscroll.js",
"./source/js/util.js",
"./source/js/app.js"
];
return gulp
.src(files)
.pipe(concat("bundle.js"))
.pipe(uglify())
.pipe(gulp.dest("./source/js"));
});
gulp.task("rev", function(argument) {
gulp
.src("./layout/_partial/style.ejs")
.pipe(
reveasy({
base: path.join(process.cwd(), "source"),
fileTypes: ["css", "js"]
})
)
.pipe(gulp.dest("./layout/_partial"));
});