-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
67 lines (56 loc) · 1.54 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
var gulp = require('gulp')
, minifyCSS = require('gulp-minify-css')
, uglify = require('gulp-uglify')
, gulpJade = require('gulp-jade')
, rename = require('gulp-rename')
, del = require('del')
, jade = require('jade')
, minifyInline = require('gulp-minify-inline')
;
var paths = {
watch: 'src/**/*.jade',
jade: ['src/**/*.jade', '!src/include/*.jade'],
js: 'src/js/**/*',
css: 'src/css/**/*',
bin: ['src/img*/**/*', 'src/fonts*/**/*'],
};
gulp.task('clean', function(cb) {
del(['build'], cb);
});
gulp.task('copy', ['clean'], function() {
return gulp.src(paths.bin).pipe(gulp.dest('build/'));
});
gulp.task('css', ['clean'], function() {
return gulp.src(paths.css)
.pipe(minifyCSS({ keepBreaks: false, keepSpecialComments: 0 }))
.pipe(gulp.dest('build/css/'))
;
});
gulp.task('js', ['clean'], function() {
return gulp.src(paths.js)
.pipe(uglify())
.pipe(gulp.dest('build/js/'))
;
});
gulp.task('jade', ['clean'], function() {
return gulp.src(paths.jade)
.pipe(gulpJade({jade: jade}))
.pipe(rename({extname: '.html'}))
.pipe(minifyInline())
.pipe(gulp.dest('build/'))
;
});
gulp.task('build', ['css', 'js', 'jade', 'copy']);
gulp.task('dev-clean-html', function(cb) {
del('src/**/*.html', cb);
});
gulp.task('dev-jade', ['dev-clean-html'], function() {
return gulp.src(paths.jade)
.pipe(gulpJade({jade: jade}))
.pipe(rename({extname: '.html'}))
.pipe(gulp.dest('src/'))
;
});
gulp.task('dev', ['dev-jade'], function() {
gulp.watch(paths.watch, ['dev-jade']);
});