-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
61 lines (57 loc) · 1.32 KB
/
gulpfile.js
File metadata and controls
61 lines (57 loc) · 1.32 KB
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
50
51
52
53
54
55
56
57
58
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var pump = require('pump');
//html
var htmlmin = require('gulp-htmlmin');
//css
var cleanCSS = require('gulp-clean-css');
var clean = require('gulp-clean');
var rename = require('gulp-rename');
//css mini
gulp.task('css', function() {
return gulp.src('talentHome/css/*.css')
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest('dist/css/'));
});
//html
gulp.task('html', function() {
return gulp.src('talentHome/*.html')
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('dist/'))
});
//static
gulp.task('copy:static',function(){
gulp.src('talentHome/static/**/*')
.pipe(rename(function(path){
path.dirname +='';
}))
.pipe(gulp.dest('./dist/static/'))
});
gulp.task('copy:img', function() {
gulp.src(['talentHome/**/**/*.png', 'talentHome/**/**/*.jpg'])
.pipe(rename(function(path) {
path.dirname += '';
}))
.pipe(gulp.dest("dist/"));
});
//clean
gulp.task('clean',function(){
gulp.src('dist/',{
read:false
})
.pipe(clean({
force:true
}));
});
//js
gulp.task('js',function(cb){
pump([
gulp.src(['talentHome/js/*.js']),
uglify(),
gulp.dest('dist/js/')
],
cb
);
});
//default
gulp.task('default',["js","css","copy:img","copy:static","html"]);