Skip to content

Commit

Permalink
Add browsersync for custom css
Browse files Browse the repository at this point in the history
Use browsersync.stream() to stream update the custom css file
(custom1.css).
  • Loading branch information
danmichaelo committed Oct 26, 2016
1 parent 60e6339 commit 4139afe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions gulp/browserSyncManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var browserSync = require('browser-sync');
module.exports = {
closeServer: closeServer,
reloadServer: reloadServer,
streamToServer: streamToServer,
startServer: startServer,
};

Expand All @@ -15,6 +16,10 @@ function reloadServer(label) {
return browserSync.get('production').reload();
}

function streamToServer() {
return browserSync.get('production').stream();
}

function startServer(args) {
var label = args.label;
var port = args.port;
Expand Down
6 changes: 5 additions & 1 deletion gulp/tasks/servers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ let prompt = require('prompt');



gulp.task('setup_watchers', ['watch-js'], () => {
gulp.task('setup_watchers', ['watch-js', 'watch-css'], () => {
gulp.watch(config.buildParams.customPath(),() => {
return browserSyncManager.reloadServer();
});
gulp.watch(config.buildParams.customCssPath(),() => {
return gulp.src(config.buildParams.customCssPath())
.pipe(browserSyncManager.streamToServer());
});
});


Expand Down

0 comments on commit 4139afe

Please sign in to comment.