-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
48 lines (38 loc) · 1.11 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
var gulp = require('gulp');
var rsequence = require('run-sequence');
var _$ = require('gulp-load-plugins')();
gulp.task('clean', function() {
return gulp.src('./tmp')
.pipe(_$.clean());
});
gulp.task('build', ['clean'], function() {
rsequence('chrome');
});
gulp.task('dist', function() {
rsequence('build', 'chrome:zip');
});
gulp.task('chrome', ['chrome:js', 'chrome:css', 'chrome:img', 'chrome:icon'], function() {
return gulp.src('./src/chrome/*')
.pipe(gulp.dest('./tmp/chrome'))
});
gulp.task('chrome:js', function () {
return universalFile('chrome', 'js');
});
gulp.task('chrome:css', function () {
return universalFile('chrome', 'css');
});
gulp.task('chrome:img', function () {
return universalFile('chrome', 'img');
});
gulp.task('chrome:icon', function () {
return universalFile('chrome', 'icons');
});
gulp.task('chrome:zip', function() {
return gulp.src('./tmp/chrome/**/*')
.pipe(_$.zip('chrome.zip'))
.pipe(gulp.dest('./dist'));
});
function universalFile(folderName, files) {
return gulp.src('./src/' + files + '/*')
.pipe(gulp.dest('./tmp/' + folderName + '/' + files));
}