-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
53 lines (46 loc) · 1.33 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
/* eslint-env node */
const gulp = require('gulp')
const header = require('gulp-header')
const uglify = require('gulp-uglify')
const concat = require('gulp-concat')
const rename = require('gulp-rename')
const replace = require('gulp-replace')
const del = require('del')
const comments = {
mquery : '/* mQuery 0.7 (nightly) ('+ (new Date()).toLocaleString('en-us') +'), vitmalina@gmail.com */\n'
}
let tasks = {
clean(cb) {
let files = [
'dist/mquery.js',
'dist/mquery.min.js'
]
return del(files)
},
build(cb) {
return gulp
.src('src/mquery.js')
.pipe(concat('mquery.js'))
.pipe(replace('\n\n', '\n'))
.pipe(header(comments.mquery))
.pipe(gulp.dest('dist/'))
// min file
.pipe(uglify({
warnings: false,
sourceMap: false
}))
.pipe(rename({ suffix: '.min' }))
.pipe(header(comments.mquery))
.pipe(gulp.dest('dist/'))
.on('end', () => {
cb()
})
},
watch(cb) {
gulp.watch(['src/**/*.js'], tasks.build)
}
}
exports.default = gulp.series(tasks.clean, tasks.build)
exports.build = tasks.build
exports.dev = tasks.watch
exports.clean = tasks.clean