forked from elastic/generator-kibana-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
53 lines (44 loc) · 931 Bytes
/
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
import gulp from 'gulp';
import watch from 'gulp-watch';
import del from 'del';
import gutil from 'gulp-util';
import {
ifJsSource,
outputPath,
ifUnlinkEvent,
log,
removeOutput,
transpile,
reTranspile,
toLib,
} from './gulpfile.helpers';
gulp.task('clean', () => del('lib'));
gulp.task('build', ['clean'], () => {
return gulp
.src('src/**', { dot: true })
.pipe(
ifJsSource(
transpile(),
toLib()
)
);
});
gulp.task('dev', ['build'], (cb) => {
gutil.log('watching "src" and building to "lib"');
let handler;
makeHandler();
watch('src/**/*', function (file) {
handler.write(file);
});
function makeHandler() {
handler = ifUnlinkEvent(
removeOutput(),
ifJsSource(reTranspile(), toLib())
);
handler.once('error', function (err) {
console.error(err.stack);
handler = makeHandler();
});
}
});
gulp.task('default', ['build']);