-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
45 lines (37 loc) · 1.14 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
var gulp = require("gulp"),
uglify = require('gulp-uglify'),
cleanCss = require('gulp-clean-css'),
concat = require('gulp-concat');
var htmlmin = require('gulp-htmlmin'),
clean = require('gulp-clean');
gulp.task('default',function(){
});
gulp.task('clean',function(){
return gulp.src('./tmp').pipe(clean());
});
gulp.task('css',['clean'],function(){
return gulp.src(['./dev/**/*.css'])
.pipe(cleanCss())
.pipe(gulp.dest('./tmp/'));
});
gulp.task('js',['clean'], function(){//压缩js
return gulp.src(['./dev/**/*.js'])
.pipe(uglify())
.pipe(gulp.dest('./tmp/'));
});
gulp.task('img',['clean'], function(){//复制图片
return gulp.src(['./dev/**/*.{JPG,jpg,png,gif}'])
.pipe(gulp.dest('./tmp/'));
});
gulp.task('font',['clean'], function(){//复制fonts文件
return gulp.src(['./dev/images/fonts/**/**'])
.pipe(gulp.dest('./tmp/images/fonts/'));
});
gulp.task('minify',['clean'], function() {
return gulp.src(['./dev/**/*.html'])
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('./tmp/'));
});
gulp.task('all',['css','js','minify','img','font'],function(){
return gulp.src('./tmp/**/*').pipe(gulp.dest('./'));
});