-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
51 lines (44 loc) · 1.1 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
var gulp = require("gulp");
var plumber = require("gulp-plumber");
// ------------
// server
// ------------
var browser = require("browser-sync");
gulp.task("server", function() {
browser({
server: {
baseDir: "./dst/"
}
});
});
// ------------
// sass
// ------------
var sass = require("gulp-sass");
var autoprefixer = require("gulp-autoprefixer");
gulp.task("sass", function() {
gulp.src("src/sass/**/*.scss")
.pipe(plumber())
.pipe(sass())
.pipe(autoprefixer())
.pipe(gulp.dest("./dst/css"))
.pipe(browser.reload({stream: true}));
});
// ------------
// js
// ------------
var uglify = require("gulp-uglify");
gulp.task("js", function() {
gulp.src("src/js/**/*.js")
.pipe(plumber())
.pipe(uglify())
.pipe(gulp.dest("./dst/js/min"))
.pipe(browser.reload({stream: true}));
});
// ------------
// default
// ------------
gulp.task("default", ["server", "js", "sass"], function() {
gulp.watch(["src/js/**/*.js", "!dst/js/min/**/*.js"], ["js"]);
gulp.watch("src/sass/**/*.scss", ["sass"]);
})