-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (48 loc) · 1.3 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
var gulp = require("gulp");
var plumber = require('gulp-plumber');
var jade = require('gulp-jade');
var sass = require('gulp-sass');
var browserSync = require("browser-sync");
var spritesmith = require('gulp.spritesmith')
var args = require('yargs').argv;
gulp.task('jade',function () {
gulp.src('app/_jade/*.jade')
.pipe(plumber())
.pipe(jade({
pretty: true
}))
.pipe(gulp.dest('app/'));
});
gulp.task('sass', function () {
gulp.src('app/_sass/*.scss')
.pipe(plumber())
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('app/_css'));
});
gulp.task('server',function(){
browserSync({
port: 9000,
server: {
baseDir: 'app'
}
})
});
gulp.task('watch', function(){
gulp.watch([
'app/index.html',
'app/js/**/*.js',
'app/_css/*.css'
]).on('change', browserSync.reload);
gulp.watch('app/_sass/**/*',['sass']);
gulp.watch('app/_jade/**/*',['jade']);
});
gulp.task('sprite', function () {
var dir= args.env||'**'
var spriteData = gulp.src('app/pictures/'+dir+'/*.png').pipe(spritesmith({
imgName: 'sprite'+dir+'.png',
cssName: '_sprite_'+dir+'.scss',
padding: 20
}));
return spriteData.pipe(gulp.dest('app/pictures/'));
});
gulp.task('default',['server','watch']);