-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
65 lines (56 loc) · 1.38 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
64
65
const gulp = require('gulp')
const standard = require('gulp-standard')
const connect = require('gulp-connect')
const runSequence = require('run-sequence')
const babili = require('gulp-babili');
const rename = require('gulp-rename');
const ghPages = require('gulp-gh-pages')
require('gulp-release-tasks')(gulp)
gulp.task('connect', () => {
connect.server({
root: './demo',
port: 7000,
livereload: true
})
})
gulp.task('html', () => {
gulp.src(['./demo/*.html', './demo/*.html'])
.pipe(connect.reload())
})
gulp.task('minify', () => {
gulp.src('./src/dcounts-js.js')
.pipe(babili({
mangle: {
keepClassNames:true
}
}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./src'))
})
gulp.task('copy', () => {
gulp.src('./src/dcounts-js.min.js')
.pipe(gulp.dest('./demo/'))
})
gulp.task('standard', () => {
gulp.src(['./src/dcounts-js.js'])
.pipe(standard())
.pipe(standard.reporter('default', {
breakOnError: false,
quiet: true
}))
.pipe(connect.reload())
})
gulp.task('deploy', () => {
gulp.src('./demo/**/*')
.pipe(ghPages())
})
gulp.task('watch', () => {
gulp.watch('./src/dcounts-js.js', ['build'])
gulp.watch('./demo/**/*.{html,css}', ['html'])
})
gulp.task('build', () => {
runSequence('standard', 'minify', 'copy')
})
gulp.task('server', () => {
runSequence('build', 'connect', 'watch')
})