-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
43 lines (37 loc) · 925 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
40
41
42
43
/**
* Created by Donny on 17/3/23.
*/
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
gulp.task('js', function () {
return gulp.src(['./js/*/*.js', './js/*.js'])
.pipe(concat('bundle.js'))
// .pipe(uglify())
.pipe(gulp.dest('./build/'));
});
// 静态服务器
gulp.task('serve', ['js'], function () {
browserSync.init({
server: {
baseDir: "./"
}
});
gulp.watch([
"*.html",
"tpls/**/*.html",
"css/*.css",
"json/*.json"
], ["reload"]);
gulp.watch([
"js/*.js",
"js/**/*.js",
"lib/*.js"
], ["js", "reload"]);
}
);
gulp.task('reload', function () {
browserSync.reload();
});
gulp.task('default', ['serve']);