ff-stream-web

git clone git://archive.git.mtrnord.blog/MTRNord/ff-stream-web.git
Log | Files | Refs | README | LICENSE

commit d2d0a4c6269048887aadf6311c6c032b1f937c4c
parent 6b4520ac1cb8d40df3aad3989f38f18730da1f3d
Author: Josh Perez <josh@goatslacker.com>
Date:   Mon,  9 Feb 2015 00:44:17 -0800

Splits browser sync and serve

Diffstat:
Mgulpfile.js | 52+++++++++++++++++++++++++++++-----------------------
1 file changed, 29 insertions(+), 23 deletions(-)

diff --git a/gulpfile.js b/gulpfile.js @@ -115,14 +115,11 @@ gulp.task('build', ['clean'], function(cb) { // Launch a lightweight HTTP Server gulp.task('serve', function(cb) { - var nodemon = require('nodemon'); - var browserSync = require('browser-sync'); watch = true; runSequence('build', function() { - var server = require('nodemon')({ script: 'build/server.js', watch: [path.join(__dirname, 'build/server.js')], @@ -132,34 +129,43 @@ gulp.task('serve', function(cb) { }).on('crash', function() { $.util.log($.util.colors.red('nodemon crashed')); }).once('start', function() { - browserSync({ - notify: false, - // Customize the BrowserSync console logging prefix - logPrefix: 'QC', - // Run as an https by setting 'https: true' - // Note: this uses an unsigned certificate which on first access - // will present a certificate warning in the browser. - https: false, - // Informs browser-sync to proxy our Express app which would run - // at the following location - proxy: 'http://localhost:5000' - }); - - process.on('exit', function () { - browserSync.exit(); - server.emit('exit'); - }); + gulp.watch(src.assets, ['assets']); gulp.watch(src.styles, ['styles']); - gulp.watch(DEST + '/**/*.*', function (file) { - browserSync.reload(path.relative(__dirname, file.path)); - }); cb(); }); }); }); +gulp.task('sync', function() { + var browserSync = require('browser-sync'); + + runSequence('serve', function() { + browserSync({ + notify: false, + // Customize the BrowserSync console logging prefix + logPrefix: 'QC', + // Run as an https by setting 'https: true' + // Note: this uses an unsigned certificate which on first access + // will present a certificate warning in the browser. + https: false, + // Informs browser-sync to proxy our Express app which would run + // at the following location + proxy: 'http://localhost:5000' + }); + + process.on('exit', function () { + browserSync.exit(); + server.emit('exit'); + }); + + gulp.watch(DEST + '/**/*.*', function (file) { + browserSync.reload(path.relative(__dirname, file.path)); + }); + }); +}); + // Deploy to GitHub Pages gulp.task('deploy', function() {