-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
35 lines (28 loc) · 881 Bytes
/
gulpfile.js
File metadata and controls
35 lines (28 loc) · 881 Bytes
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
var gulp = require('gulp'),
gulpLoadPlugins = require('gulp-load-plugins'),
plugins = gulpLoadPlugins();
var cdnUrl = [
[ '../builds/fonts/', 'https://s.anw.red/font/' ],
[ 'assets/vue.js', 'https://s.anw.red/js/vue.min.js' ],
[ 'assets/', 'https://s.anw.red/anyway.2017/' ]
];
gulp.task('default', function() {
gulp.src('index.html')
.pipe(plugins.cacheBust({
type: 'MD5',
basePath: './'
}))
.pipe(plugins.batchReplace(cdnUrl))
.pipe(plugins.htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('builds'));
gulp.src('assets/*.css')
.pipe(plugins.cleanCss({compatibility: 'ie8'}))
.pipe(plugins.batchReplace(cdnUrl))
.pipe(gulp.dest('builds'));
gulp.src('assets/main.js')
.pipe(plugins.uglify())
.pipe(gulp.dest('builds'));
});
gulp.task('watch', function() {
gulp.watch(['*','*/*'], ['default']);
});