browserSync
This commit is contained in:
20
gulpfile.js
20
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();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user