-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
executable file
·63 lines (52 loc) · 1.54 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
var gulp = require('gulp');
var clean = require('del');
var minifyJS = require('gulp-minify');
var minifyHTML = require('gulp-htmlmin');
var minifyIMG = require('gulp-imagemin');
var cleanCSS = require('gulp-clean-css');
var zip = require('gulp-zip');
gulp.task('cleanDest', function() {
return clean(['built/**/*']);
});
gulp.task('copyFavicon', function () {
return gulp.src(['html/favicon.ico'])
.pipe(gulp.dest('built/'));
});
gulp.task('minifyHTML', function() {
return gulp.src(['html/*.html'])
.pipe(minifyHTML({collapseWhitespace: true}))
.pipe(gulp.dest('built/'));
});
gulp.task('minifyCSS', function(){
return gulp.src(['css/*.css'])
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest('built/css'));
});
gulp.task('copyRobots', function() {
return gulp.src(['html/robots.txt'])
.pipe(gulp.dest('built/'));
});
gulp.task('zipLogos', function() {
return gulp.src('built/images/logos/**/*.png')
.pipe(zip('TROLLPURSE_LOGOS.zip'))
.pipe(gulp.dest('built/images/logos/'))
});
gulp.task('minifyJS', function() {
return gulp.src('js/*.js')
.pipe(minifyJS({
ext: {
src:'.js',
min: '.js'
}
}))
.pipe(gulp.dest('built/js/'));
});
gulp.task('minifyIMG', function() {
return gulp.src(['images/**/*.*', 'html/*.ico'])
.pipe(minifyIMG())
.pipe(gulp.dest('built/images/'));
});
gulp.task('mini-copy', gulp.parallel('minifyHTML', 'minifyJS', 'minifyCSS', 'minifyIMG', 'copyRobots', 'copyFavicon'));
gulp.task('build', gulp.series('cleanDest', 'mini-copy', 'zipLogos', function(done){
done();
}));