-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (51 loc) · 1.43 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
var gulp = require('gulp');
var htmlmin = require('gulp-htmlmin');
var uglify = require('gulp-uglify');
var pump = require('pump');
var concat = require('gulp-concat');
var nano = require('gulp-cssnano');
var uncss = require('gulp-uncss');
var handlebars = require('gulp-handlebars');
var defineModule = require('gulp-define-module');
/*
var wrap = require('gulp-wrap');
var declare = require('gulp-declare');
*/
gulp.task('compress', function (cb) {
pump([
gulp.src('src/js/*.js'),
uglify(),
gulp.dest('./dist/assets/')
],
cb
);
});
gulp.task('bundle-css',function(){
return gulp.src('./src/css/*.css')
.pipe(concat('slug.css'))
/*
.pipe(uncss({
html: ['./src/*.html']
}))
.pipe(nano())
*/
.pipe(gulp.dest('./dist/assets/'));
});
gulp.task('minify', function() {
return gulp.src('src/*.html')
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('./dist/'));
});
gulp.task('copy', function(){
return gulp.src(['src/data/config.json'])
.pipe(gulp.dest('./dist/templates/'));
});
gulp.task('templates', function(){
gulp.src(['src/hbs/*.hbs'])
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(handlebars({handlebars: require('handlebars')}))
.pipe(defineModule('node'))
.pipe(gulp.dest('./dist/templates/'));
});
gulp.task('build',['templates','compress','copy','bundle-css']);
gulp.task('build-dev',['minify','compress','copy','bundle-css'])