-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.js
37 lines (31 loc) · 895 Bytes
/
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
'use strict'
var del = require('del')
var gulp = require("gulp");
var uglify = require("gulp-uglify")
var gulpif = require("gulp-if")
var minifyCss = require('gulp-minify-css')
var zip = require('gulp-zip')
gulp.task('clean-dist', function (cb) {
del(['dist', 'dist.zip'], cb)
})
gulp.task('release', ['clean-dist'], function (cb) {
var gulpJSFilter = function (file) {
console.log(file.path)
if (file.path.match(/\.js$/)) {
return true
}
}
var gulpCSSFilter = function (file) {
if (file.path.match(/\.css$/)) {
return true
}
}
var stream = gulp.src(['reader/**/*.*'])
.pipe(gulpif(gulpJSFilter, uglify()))
.pipe(gulpif(gulpCSSFilter, minifyCss()))
.pipe(gulp.dest('dist'))
.pipe(zip('dist.zip'))
.pipe(gulp.dest('.'))
return stream
})
gulp.start('release')