-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
57 lines (50 loc) · 1.13 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
'use strict'
var path = require('path')
var gulp = require('gulp')
var del = require('del')
var concat = require('gulp-concat')
var wrap = require('gulp-wrap')
var replace = require('gulp-replace')
var uglify = require('gulp-uglify')
var myPath = {
src: './src/',
dest: './dist/',
debug: './_debug/',
}
var fileList = [
'./src/meta.js',
'./src/shim.js',
'./src/core.js',
'./src/util.js',
'./src/style.js',
'./src/init.js',
]
var fileName = 'turingbook-epub-patch.user.js'
gulp.task('default', ['clean'], function () {
gulp.start('js')
})
gulp.task('clean', function () {
del(path.join(myPath.dest, '*.*'))
})
gulp.task('watch', ['dev'], function () {
gulp.watch([
path.join(myPath.src, '**/*.*'),
//'gulpfile.js',
'*.json',
], ['dev'])
})
gulp.task('dev', function () {
gulp.src(fileList)
.pipe(concat(fileName))
.pipe(gulp.dest(myPath.debug))
})
gulp.task('js', function() {
gulp.src(fileList)
.pipe(concat(fileName))
.pipe(replace(/\/\*\* DEBUG_INFO_START \*\*\//g, '/*'))
.pipe(replace(/\/\*\* DEBUG_INFO_END \*\*\//g, '*/'))
//.pipe(uglify({
// preserveComments: 'some'
//}))
.pipe(gulp.dest(myPath.dest))
})