From 37357305690e4152430a428b6e0499c06f419d0b Mon Sep 17 00:00:00 2001 From: guix Date: Wed, 28 Jan 2015 07:40:49 +0100 Subject: [PATCH] browserSync --- gulpfile.js | 20 ++++++++++++++------ package.json | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index b701c98..3d5b89c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -3,6 +3,7 @@ var $ = require('gulp-load-plugins')(); var _ = require('lodash'); var argv = require('yargs').argv; +var browserSync = require('browser-sync'); var gulp = require('gulp'); var lazypipe = require('lazypipe'); var merge = require('merge-stream'); @@ -127,6 +128,13 @@ var writeToManifest = function(directory) { .pipe(gulp.dest, path.dist)(); }; +// Start the server +gulp.task('browser-sync', function() { + browserSync({ + proxy: "aubonsite" + }); +}); + // ## Gulp Tasks // Run `gulp -T` for a task summary @@ -139,7 +147,8 @@ gulp.task('styles', function() { .pipe(cssTasks(dep.name))); }); return merged - .pipe(writeToManifest('styles')); + .pipe(writeToManifest('styles')) + .pipe(browserSync.reload({stream:true})); }); // ### Scripts @@ -194,13 +203,12 @@ gulp.task('clean', require('del').bind(null, [path.dist])); // ### Watch // `gulp watch` - recompile assets whenever they change -gulp.task('watch', function() { - $.livereload.listen(); +gulp.task('watch', ['browser-sync'], function() { gulp.watch([path.source + 'styles/**/*'], ['styles']); - gulp.watch([path.source + 'scripts/**/*'], ['jshint', 'scripts']); + gulp.watch([path.source + 'scripts/**/*'], ['jshint', 'scripts', browserSync.reload]); gulp.watch(['bower.json'], ['wiredep']); - gulp.watch('**/*.php').on('change', function(file) { - $.livereload.changed(file.path); + gulp.watch('**/*.php', function () { + browserSync.reload(); }); }); diff --git a/package.json b/package.json index 6716046..1d72c38 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ }, "devDependencies": { "asset-builder": "~0.3.0", + "browser-sync": "^1.9.1", "del": "^1.1.1", "gulp": "^3.8.10", "gulp-changed": "^1.1.0", @@ -36,7 +37,6 @@ "gulp-imagemin": "^2.0.0", "gulp-jshint": "^1.8.4", "gulp-less": "^2.0.1", - "gulp-livereload": "^3.4.0", "gulp-load-plugins": "^0.8.0", "gulp-pleeease": "^1.1.0", "gulp-plumber": "^0.6.3",