Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -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 | |
Matteo Scandolo | 828d1e8 | 2017-01-17 14:49:38 -0800 | [diff] [blame] | 13 | gulp.task('build', gulp.series(gulp.parallel('other', 'webpack:dist'))); |
| 14 | gulp.task('test', gulp.series('karma:single-run')); |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 15 | gulp.task('test:auto', gulp.series('karma:auto-run')); |
Matteo Scandolo | 828d1e8 | 2017-01-17 14:49:38 -0800 | [diff] [blame] | 16 | gulp.task('serve', gulp.series('webpack:watch', 'watch', 'browsersync')); |
| 17 | gulp.task('serve:dist', gulp.series('default', 'browsersync:dist')); |
Matteo Scandolo | 4e87023 | 2017-01-30 13:43:05 -0800 | [diff] [blame] | 18 | gulp.task('serve:dist:watch', gulp.series('clean', 'other', 'webpack:dist:watch', 'browsersync:dist')); |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 19 | gulp.task('default', gulp.series('clean', 'build')); |
| 20 | gulp.task('watch', watch); |
| 21 | |
| 22 | function reloadBrowserSync(cb) { |
| 23 | browserSync.reload(); |
| 24 | cb(); |
| 25 | } |
| 26 | |
| 27 | function watch(done) { |
| 28 | gulp.watch(conf.path.tmp('index.html'), reloadBrowserSync); |
| 29 | done(); |
| 30 | } |