-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
40 lines (38 loc) · 1000 Bytes
/
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
const gulp = require('gulp');
const babelify = require('babelify');
const browserify = require('browserify');
const watchify = require('watchify');
const source = require('vinyl-source-stream');
const paths = {
src: './scripts/',
dist: './lib/',
files: [
'translator-core.js',
'global-translator.js',
'signin-translator.js',
'signout-translator.js',
'forgot-translator.js',
'messages-translator.js',
'invite-translator.js',
],
};
gulp.task('watch', () => {
paths.files.forEach((entry) => {
const bundler = watchify(
browserify({
cache: {},
entries: [`${paths.src}/${entry}`],
transform: babelify.configure({ presets: ['es2015'] }),
debug: true,
packageCache: {},
}));
const bundle = () =>
bundler
.bundle()
.pipe(source(entry))
.pipe(gulp.dest(paths.dist));
bundler.on('update', bundle);
bundler.on('log', msg => console.log(msg));
return bundle();
});
});