browserSync
This commit is contained in:
20
gulpfile.js
20
gulpfile.js
@@ -3,6 +3,7 @@
|
|||||||
var $ = require('gulp-load-plugins')();
|
var $ = require('gulp-load-plugins')();
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
var argv = require('yargs').argv;
|
var argv = require('yargs').argv;
|
||||||
|
var browserSync = require('browser-sync');
|
||||||
var gulp = require('gulp');
|
var gulp = require('gulp');
|
||||||
var lazypipe = require('lazypipe');
|
var lazypipe = require('lazypipe');
|
||||||
var merge = require('merge-stream');
|
var merge = require('merge-stream');
|
||||||
@@ -127,6 +128,13 @@ var writeToManifest = function(directory) {
|
|||||||
.pipe(gulp.dest, path.dist)();
|
.pipe(gulp.dest, path.dist)();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Start the server
|
||||||
|
gulp.task('browser-sync', function() {
|
||||||
|
browserSync({
|
||||||
|
proxy: "aubonsite"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// ## Gulp Tasks
|
// ## Gulp Tasks
|
||||||
// Run `gulp -T` for a task summary
|
// Run `gulp -T` for a task summary
|
||||||
|
|
||||||
@@ -139,7 +147,8 @@ gulp.task('styles', function() {
|
|||||||
.pipe(cssTasks(dep.name)));
|
.pipe(cssTasks(dep.name)));
|
||||||
});
|
});
|
||||||
return merged
|
return merged
|
||||||
.pipe(writeToManifest('styles'));
|
.pipe(writeToManifest('styles'))
|
||||||
|
.pipe(browserSync.reload({stream:true}));
|
||||||
});
|
});
|
||||||
|
|
||||||
// ### Scripts
|
// ### Scripts
|
||||||
@@ -194,13 +203,12 @@ gulp.task('clean', require('del').bind(null, [path.dist]));
|
|||||||
|
|
||||||
// ### Watch
|
// ### Watch
|
||||||
// `gulp watch` - recompile assets whenever they change
|
// `gulp watch` - recompile assets whenever they change
|
||||||
gulp.task('watch', function() {
|
gulp.task('watch', ['browser-sync'], function() {
|
||||||
$.livereload.listen();
|
|
||||||
gulp.watch([path.source + 'styles/**/*'], ['styles']);
|
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(['bower.json'], ['wiredep']);
|
||||||
gulp.watch('**/*.php').on('change', function(file) {
|
gulp.watch('**/*.php', function () {
|
||||||
$.livereload.changed(file.path);
|
browserSync.reload();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"asset-builder": "~0.3.0",
|
"asset-builder": "~0.3.0",
|
||||||
|
"browser-sync": "^1.9.1",
|
||||||
"del": "^1.1.1",
|
"del": "^1.1.1",
|
||||||
"gulp": "^3.8.10",
|
"gulp": "^3.8.10",
|
||||||
"gulp-changed": "^1.1.0",
|
"gulp-changed": "^1.1.0",
|
||||||
@@ -36,7 +37,6 @@
|
|||||||
"gulp-imagemin": "^2.0.0",
|
"gulp-imagemin": "^2.0.0",
|
||||||
"gulp-jshint": "^1.8.4",
|
"gulp-jshint": "^1.8.4",
|
||||||
"gulp-less": "^2.0.1",
|
"gulp-less": "^2.0.1",
|
||||||
"gulp-livereload": "^3.4.0",
|
|
||||||
"gulp-load-plugins": "^0.8.0",
|
"gulp-load-plugins": "^0.8.0",
|
||||||
"gulp-pleeease": "^1.1.0",
|
"gulp-pleeease": "^1.1.0",
|
||||||
"gulp-plumber": "^0.6.3",
|
"gulp-plumber": "^0.6.3",
|
||||||
|
|||||||
Reference in New Issue
Block a user