-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
40 lines (29 loc) · 959 Bytes
/
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
var gulp = require('gulp'),
gulpLoadPlugins = require('gulp-load-plugins'),
plugins = gulpLoadPlugins();
var cnUrl = [
[ 'main.css', 'http://anyway-web.b0.upaiyun.com/analytttics/main.min.css' ],
[ 'build/all.js', 'http://anyway-web.b0.upaiyun.com/analytttics/all.js' ]
];
gulp.task('watch', function() {
gulp.watch(['*','*/*'], ['default']);
});
gulp.task('default', function() {
gulp.src('index.php')
.pipe(plugins.htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('build'));
gulp.src('index-cn.php')
.pipe(plugins.batchReplace(cnUrl))
.pipe(plugins.htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('build'));
gulp.src(['js/*.js','!js/d3.min.js'])
.pipe(plugins.uglify())
.pipe(plugins.concat('all.js'))
.pipe(gulp.dest('build'));
gulp.src('main.css')
.pipe(plugins.cleanCss({compatibility: 'ie8'}))
.pipe(plugins.rename({
suffix: '.min'
}))
.pipe(gulp.dest('build'));
});