Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame^] | 1 | var options = require('../gulp-options.js'), gulp = require('gulp'), |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 2 | connect = require('gulp-connect'), |
| 3 | distribution = require('./distribution.js'); |
| 4 | |
| 5 | var runSequence = require('run-sequence'); |
| 6 | |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame^] | 7 | gulp.task('distribution', function(callback) { |
| 8 | return distribution(callback); |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 9 | }); |
| 10 | |
| 11 | gulp.task('connect', function() { |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame^] | 12 | connect.server({root: 'dist', livereload: true}); |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 13 | }); |
| 14 | |
| 15 | gulp.task('livereload', function() { |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame^] | 16 | gulp.src(['./dist/**/*.html', './dist/**/*.js', './dist/**/*.css']) |
| 17 | .pipe(connect.reload()); |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 18 | }); |
| 19 | |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame^] | 20 | gulp.task('watch', function() { |
| 21 | gulp.watch('./app/**/*', function(callback) { |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 22 | return runSequence('distribution', 'livereload'); |
| 23 | }); |
| 24 | }); |
| 25 | |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame^] | 26 | module.exports = function(callback) { |
| 27 | return runSequence('connect', 'watch', callback); |
| 28 | }; |