Skip to content

Commit

Permalink
[BUGFIX] new browser-sync syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
brousalis committed Jan 19, 2016
1 parent d24558e commit dd693dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
9 changes: 7 additions & 2 deletions gulpfile.js/tasks/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ var gulp = require('gulp');
var gutil = require('gulp-util');
var path = require('path');
var runSequence = require('run-sequence');
var browserSync = require('browser-sync');
var browserSync = require('browser-sync').create();
var browserSyncSpa = require('browser-sync-spa');

// Better support for Angular and BrowserSync
browserSync.use(browserSyncSpa({selector: '[ng-app]'}));

// Development server
function server(callback) {
browserSync.instance = browserSync.init({
browserSync.init({
startPath: '/',
server: {
baseDir: [config.paths.tmp, config.paths.src],
Expand All @@ -23,6 +23,11 @@ function server(callback) {
port: config.port
});

// Watch the root index file for changes
browserSync.watch(path.join(config.paths.src, '/*.html')).on('change', function() {
runSequence('inject', browserSync.reload)
});

callback();
}

Expand Down
4 changes: 2 additions & 2 deletions gulpfile.js/tasks/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var path = require('path');

var gulp = require('gulp');
var browserSync = require('browser-sync');
var browserSync = require('browser-sync').create();
var minifyHtml = require('gulp-minify-html');
var angularTemplatecache = require('gulp-angular-templatecache');
var changed = require('gulp-changed');
Expand All @@ -19,7 +19,7 @@ gulp.task('templates', ['markup'], function(callback) {
standalone: true
}))
.pipe(gulp.dest(path.join(config.paths.tmp, '/templates')))
.pipe(browserSync.reload({ stream: true }));
.pipe(browserSync.stream());
});

// Compiles changed html files to the dev folder
Expand Down
4 changes: 1 addition & 3 deletions gulpfile.js/tasks/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ var path = require('path');

// Task to watch files for changes, and reload them
function watch() {
// When HTML files are changed (or more bower components added)
// When template HTML files are changed
gulp.watch([
path.join(config.paths.src, '/**/*.html'),
path.join(config.paths.src, '/*.html'),
'bower.json'
], function(event) {
if (event.type === 'changed') {
gulp.start('templates');
Expand Down

0 comments on commit dd693dc

Please sign in to comment.