-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
85 lines (74 loc) · 1.85 KB
/
gulpfile.babel.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// generated on 2017-07-15 using generator-chrome-extension 0.6.1
import gulp from 'gulp';
import gulpLoadPlugins from 'gulp-load-plugins';
import del from 'del';
import runSequence from 'run-sequence';
const $ = gulpLoadPlugins();
gulp.task('icons', () => {
return gulp.src('app/icons/**/*')
.pipe($.if($.if.isFile, $.cache($.imagemin({
progressive: true,
interlaced: true,
svgoPlugins: [{cleanupIDs: false}]
}))
.on('error', function (err) {
console.log(err);
this.end();
})))
.pipe(gulp.dest('dist/icons'));
});
gulp.task('chromeManifest', () => {
return gulp.src('app/manifest.json')
.pipe($.chromeManifest({
buildnumber: true,
background: {
target: 'scripts/background.js'
}
}))
.pipe(gulp.dest('dist'));
});
gulp.task('babel', () => {
return gulp.src('dist/scripts/**')
.pipe($.babel({
presets: ['es2015']
}))
.pipe(gulp.dest('dist/scripts'));
});
gulp.task('stuff', () => {
return gulp.src(['app/_locales/**']).pipe(gulp.dest('dist/_locales'));
});
gulp.task('clean', del.bind(null, ['.tmp', 'dist']));
gulp.task('size', () => {
return gulp.src('dist/**/*').pipe($.size({title: 'build', gzip: true}));
});
gulp.task('package', function () {
var manifest = require('./dist/manifest.json');
return gulp.src('dist/**')
.pipe($.zip('donna-' + manifest.version + '.zip'))
.pipe(gulp.dest('package'));
});
gulp.task('hot', function () {
return $.watch(
[
'app/app/components/**',
'app/app/middleware/**',
'app/app/assets/**',
'app/scripts/**'
],
{ ignoreInitial: true }
)
.pipe($.shell(['npm start']));
});
gulp.task('build', (cb) => {
runSequence(
'stuff',
'chromeManifest',
'babel',
'icons',
'size',
cb
);
});
gulp.task('default', ['clean'], cb => {
runSequence('build', cb);
});