Matteo Scandolo | fc4b37b | 2017-02-02 12:18:47 -0800 | [diff] [blame] | 1 | const gulp = require('gulp'); |
| 2 | const HubRegistry = require('gulp-hub'); |
| 3 | const browserSync = require('browser-sync'); |
| 4 | |
| 5 | const conf = require('./conf/gulp.conf'); |
| 6 | |
| 7 | // Load some files into the registry |
| 8 | const hub = new HubRegistry([conf.path.tasks('*.js')]); |
| 9 | |
| 10 | // Tell gulp to use the tasks just loaded |
| 11 | gulp.registry(hub); |
| 12 | |
| 13 | gulp.task('build', gulp.series(gulp.parallel('other', 'webpack:dist'))); |
| 14 | gulp.task('test', gulp.series('karma:single-run')); |
| 15 | gulp.task('test:auto', gulp.series('karma:auto-run')); |
| 16 | gulp.task('serve', gulp.series('webpack:watch', 'watch', 'browsersync')); |
| 17 | gulp.task('serve:dist', gulp.series('default', 'browsersync:dist')); |
| 18 | gulp.task('default', gulp.series('clean', 'build')); |
| 19 | gulp.task('watch', watch); |
| 20 | |
| 21 | function reloadBrowserSync(cb) { |
| 22 | browserSync.reload(); |
| 23 | cb(); |
| 24 | } |
| 25 | |
| 26 | function watch(done) { |
| 27 | gulp.watch(conf.path.tmp('index.html'), reloadBrowserSync); |
| 28 | done(); |
| 29 | } |