-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
51 lines (42 loc) · 1.28 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
'use strict';
var chalk = require('chalk')
, config = require('./gulp/config');
config.log(chalk.cyan('Loading gulp tasks'));
require('./gulp/tasks/clean');
require('./gulp/tasks/connect');
require('./gulp/tasks/fonts');
require('./gulp/tasks/html');
require('./gulp/tasks/images');
require('./gulp/tasks/less');
require('./gulp/tasks/libs');
require('./gulp/tasks/mathjax');
require('./gulp/tasks/scripts');
require('./gulp/tasks/templates');
require('./gulp/tasks/watch');
var gulp = require('gulp')
, rename = require('gulp-rename');
require('clean-css');
gulp.task('build', function() {
return require('run-sequence')(
'clean',
['libs', 'scripts', 'fonts', 'images', 'less', 'html', 'templates']
// 'postprocess',
// 'cdnize'
);
});
gulp.task('package', ['build'], function() {
var gzip = require('gulp-gzip')
, revall = require('gulp-rev-all');
return gulp.src(['./build/**'])
.pipe(revall())
.pipe(rename(function(path) {
if (/index[-\.]\w+/.test(path.basename) && path.extname === '.html') {
path.basename = 'index';
}
}))
.pipe(gulp.dest('./dist'))
.pipe(gzip())
.pipe(gulp.dest('./dist'));
});
//gulp.task('build', ['scripts', 'images', 'templates', 'less', 'html']);
gulp.task('default', ['build', 'watch', 'connect']);