-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
43 lines (36 loc) · 1.04 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
var gulp = require('gulp'),
//加载gulp-load-plugins插件,并马上运行它
plugins = require('gulp-load-plugins')(),
connect = require('gulp-connect');
gulp.task('connect', function() {
plugins.connect.server({
port: 80,
host: '0.0.0.0',
livereload: true
});
});
gulp.task('html', function () {
gulp.src('index.html')
.pipe(connect.reload());
});
gulp.task('css', function () {
gulp.src('src/**/index.styl')
.pipe(plugins.stylus())
.pipe(gulp.dest('static'))
.pipe(connect.reload());
});
gulp.task('image', function () {
gulp.src('src/images/*.{jpg,png,gif,ico}')
.pipe(plugins.imagemin())
.pipe(gulp.dest('static/images'))
.pipe(connect.reload());
});
gulp.task('watch', function () {
gulp.watch(['index.html'], ['html']);
gulp.watch(['src/css/*'], ['css']);
gulp.watch(['src/images/*'], ['image']);
});
// gulp.task('default', ['connect','watch']);
gulp.task('default', gulp.series('connect', 'watch', function() {
// Do something
}));