forked from nicholaswan/jjb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
55 lines (47 loc) · 1.62 KB
/
Copy pathgulpfile.js
File metadata and controls
55 lines (47 loc) · 1.62 KB
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
var gulp = require('gulp');
var concat = require('gulp-concat');
var minify = require('gulp-minify');
var cleanCss = require('gulp-clean-css');
var optimizejs = require('gulp-optimize-js');
var watch = require('gulp-watch');
gulp.task('watch', function () {
// watch many files
watch([
'manifest.json', '*.html',
'static/*.js', 'static/style/*.css'
], function () {
gulp.start('default');
});
});
gulp.task('pack-js', function () {
gulp.src(['static/jquery.js', 'static/garlic.js', 'static/tippy.min.js', 'static/moment.min.js', 'static/popup.js'])
.pipe(concat('bundle.js'))
.pipe(optimizejs({
sourceMap: true
}))
.pipe(gulp.dest('build/static/js'));
console.log("pack-js task done @", new Date())
});
gulp.task('pack-css', function () {
return gulp.src(['static/style/weui.min.css', 'static/style/popup.css', 'static/style/tippy.css'])
.pipe(concat('popupstyle.css'))
.pipe(cleanCss())
.pipe(gulp.dest('build/static/style'));
});
gulp.task('move-static', [], function () {
gulp.src([
'static/audio/*.*', 'static/image/*.*', 'static/style/*.css',
'static/background.js', 'static/content_script.js', 'static/jquery.js',
'static/lodash.js', 'static/start.js', 'static/zepto.min.js', 'static/moment.min.js',
'static/template-web.js'
], { base: './' })
.pipe(gulp.dest('build'));
});
gulp.task('move-file', [], function () {
gulp.src([
'background.html', 'manifest.json', 'popup.html', 'start.html', '*.html'
])
.pipe(gulp.dest('build'));
});
gulp.task('default', ['move-static', 'move-file', 'pack-js', 'pack-css']);
gulp.task('dev', ['default', 'watch']);