-
Notifications
You must be signed in to change notification settings - Fork 133
/
Copy pathgulpfile.js
52 lines (42 loc) · 1.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
50
51
52
var gulp = require('gulp')
var uglify = require('gulp-uglify')
var minify = require('gulp-minify-css')
var rename = require('gulp-rename')
var del = require('del')
var release = require('gulp-gh-pages')
var DEST = 'dist'
var SRC_SCRIPTS = 'src/js/*.js'
var SRC_STYLES = 'src/css/*.css'
gulp.task('scripts', buildScripts)
gulp.task('styles', buildStyles)
gulp.task('build', gulp.parallel('scripts', 'styles'))
gulp.task('clean', cleanDest)
gulp.task('cleanbuild', gulp.series('clean', 'build'))
gulp.task('release', release)
gulp.task('default', gulp.series('clean', 'build'))
/**
* task fns
*/
function buildScripts(){
return gulp.src(SRC_SCRIPTS)
.pipe(gulp.dest(DEST + '/js'))
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(DEST + '/js'))
}
function buildStyles(){
return gulp.src(SRC_STYLES)
.pipe(gulp.dest(DEST + '/css'))
.pipe(minify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(DEST + '/css'))
}
function cleanDest(cb){
return del(DEST, cb)
}
function release(){
return gulp.src('./dist/**/*')
.pipe(release({
branch: 'dist'
}))
}