commit d84f40ceda21ee73d2a3537a75ce24de99dc044f
parent 6b4520ac1cb8d40df3aad3989f38f18730da1f3d
Author: Konstantin Tarkus <koistya@gmail.com>
Date: Mon, 9 Feb 2015 14:08:27 +0300
Merge pull request #65 from goatslacker/split-bs
Splits browser sync and serve
Diffstat:
| M | gulpfile.js | | | 45 | +++++++++++++++++++++++++-------------------- |
1 file changed, 25 insertions(+), 20 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,42 @@ 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', ['serve'], function() {
+ var browserSync = require('browser-sync');
+
+ 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();
+ });
+
+ gulp.watch(DEST + '/**/*.*', function (file) {
+ browserSync.reload(path.relative(__dirname, file.path));
+ });
+});
+
// Deploy to GitHub Pages
gulp.task('deploy', function() {