-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
50 lines (41 loc) · 1 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
var gulp = require('gulp');
var br = require('browser-sync');
var less = require('gulp-less');
var sourcemaps = require('gulp-sourcemaps');
var option='';
gulp.task('build:js',function(cb){
gulp.src('src/**/*.js',option)
.pipe(gulp.dest('dist'))
cb();
});
gulp.task('build:res',function(cb){
gulp.src('src/**/**',option)
.pipe(gulp.dest('dist'))
cb();
});
gulp.task('build:html',function(cb){
gulp.src('src/**/*.html',option)
.pipe(gulp.dest('dist'))
cb();
});
gulp.task('build:style',function(cb){
gulp.src('src/**/*.less',option)
.pipe(sourcemaps.init())
.pipe(less())
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'))
cb();
});
gulp.task('build',function(){
br.create().init({
server: {
baseDir: './dist'
},
files: '**',
open: false,
//https: true,
port: 8088
});
});
gulp.watch('src/**/**',gulp.series('build:html','build:js','build:style','build:res'));
gulp.task('default',gulp.series('build:html','build:js','build:style','build:res','build'));