-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
59 lines (50 loc) · 1.34 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
var gulp = require('gulp'),
gulpif = require('gulp-if'),
sequence = require('run-sequence'),
cssmin = require('gulp-cssmin'),
clean = require('gulp-clean'),
terser = require('gulp-terser'),
manifest = require('gulp-chrome-manifest'),
zip = require('gulp-zip');
var distDir = 'dist/';
gulp.task('build', function() {
return gulp.src('manifest.json')
.pipe(manifest({
buildnumber: true
}))
.pipe(gulpif('css/**/*.css', cssmin()))
//.pipe(gulpif('js/**/*.js', terser()))
.pipe(gulp.dest(distDir))
});
gulp.task('copyImages', function() {
return gulp.src('css/images/*')
.pipe(gulp.dest(distDir + 'css/images'));
});
gulp.task('copyIcons', function() {
return gulp.src('icons/*')
.pipe(gulp.dest(distDir + 'icons'));
});
gulp.task('copyOptions', function() {
return gulp.src('options.html')
.pipe(gulp.dest(distDir));
});
gulp.task('copyManifest', function() {
return gulp.src(distDir + 'manifest.json')
.pipe(gulp.dest('./'));
});
gulp.task('zip', () =>
gulp.src([
distDir + '**/*',
'!__MACOSX/**',
'!**/.DS_Store'
])
.pipe(zip('upload.zip'))
.pipe(gulp.dest('./'))
);
gulp.task('clean', function () {
return gulp.src(distDir, {read: false})
.pipe(clean());
});
gulp.task('default', function(){
return sequence('build', 'copyImages', 'copyIcons', 'copyOptions', 'copyManifest', 'zip', 'clean');
});