-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
74 lines (65 loc) · 1.72 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
64
65
66
67
68
69
70
71
72
73
74
var gulp = require("gulp");
var ejs = require("gulp-ejs"),
sass = require("gulp-ruby-sass"),
pleeease = require("gulp-pleeease"),
browser = require("browser-sync");
var DEV = "app/dev",
PUBLIC = "app/public";
//ejs
gulp.task("ejs", function() {
gulp.src(
[DEV + "/ejs/**/*.ejs",'!' + DEV + "/ejs/**/_*.ejs"]
)
.pipe(ejs())
.pipe(gulp.dest(PUBLIC))
.pipe(browser.reload({stream:true}));
});
//style
gulp.task("style", function() {
gulp.src(DEV + "/sass/**/*.scss")
.pipe(sass({
style:"nested",
compass : true,
"sourcemap=none": true
}))
.pipe(pleeease({
fallbacks: {
autoprefixer: ["last 2 version", "ie 9"]
},
minifier: false
}))
.pipe(gulp.dest(PUBLIC + "/css"))
.pipe(browser.reload({stream:true}));
});
//copy
gulp.task("js", function() {
return gulp.src(DEV + "/js/**/*.js")
.pipe(gulp.dest(PUBLIC + "/js"));
});
//lib
gulp.task("lib", function() {
return gulp.src(DEV + "/lib/**/*.js")
.pipe(gulp.dest(PUBLIC + "/lib"));
});
//lib
gulp.task("images", function() {
return gulp.src(DEV + "/images/**/*")
.pipe(gulp.dest(PUBLIC + "/images"));
});
//browser sync
gulp.task("server", function() {
browser({
server: {
baseDir: PUBLIC
},
port: 5000
});
});
//watch
gulp.task("default",["ejs","style","js","lib","images","server"], function() {
gulp.watch(DEV + "/ejs/**/*.ejs",["ejs"]);
gulp.watch(DEV + "/sass/**/*.scss",["style"]);
gulp.watch(DEV + "js/**/*.js",["js"]);
gulp.watch(DEV + "lib/**/*.js",["lib"]);
gulp.watch(DEV + "images/**/*",["images"]);
});