-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.babel.js
executable file
·43 lines (32 loc) · 1 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
import gulp from 'gulp';
import loadPlugins from 'gulp-load-plugins';
import webpack from 'webpack';
import rimraf from 'rimraf';
const plugins = loadPlugins();
import contentWebpackConfig from './content/webpack.config';
gulp.task('content-js', ['clean'], cb => {
webpack(contentWebpackConfig, (err, stats) => {
if (err) throw new plugins.util.PluginError('webpack', err);
plugins.util.log('[webpack]', stats.toString());
cb();
});
});
gulp.task('copy-manifest', ['clean'], () => {
return gulp.src('manifest.json').pipe(gulp.dest('./build'));
});
gulp.task('copy-locales', ['clean'], function() {
return gulp
.src(['./_locales/**/*'], {
base: '.',
})
.pipe(gulp.dest('./build'));
});
gulp.task('clean', cb => {
rimraf('./build', cb);
});
gulp.task('build', ['copy-manifest', 'copy-locales', 'content-js']);
gulp.task('watch', ['default'], () => {
gulp.watch('content/**/*', ['build']);
gulp.watch('injected_script.js', ['build']);
});
gulp.task('default', ['build']);