Switches from livereload to browsersync

Formatting
Removes references to livereload
Removes enqueued livereload client
This commit is contained in:
Austin Pray
2015-01-28 09:22:05 -06:00
parent cf4f58d5cc
commit c85d059239
3 changed files with 20 additions and 28 deletions

View File

@@ -24,5 +24,8 @@
"modernizr.js": {
"bower": ["modernizr"]
}
},
"config": {
"devUrl": "example.dev"
}
}

View File

@@ -1,12 +1,12 @@
// ## Globals
/*global $:true*/
var $ = require('gulp-load-plugins')();
var _ = require('lodash');
var argv = require('yargs').argv;
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');
var gulp = require('gulp');
var lazypipe = require('lazypipe');
var merge = require('merge-stream');
// See https://github.com/austinpray/asset-builder
var manifest = require('asset-builder')('./assets/manifest.json');
@@ -16,6 +16,9 @@ var manifest = require('asset-builder')('./assets/manifest.json');
// - `path.dist` - Path to the build directory. default: `dist/`
var path = manifest.paths;
// `config` - Store arbitrary configuration values here.
var config = manifest.config || {};
// `globs` - These ultimately end up in their respective `gulp.src`.
// - `globs.js` - array of asset-builder js Depenency objects. Example:
// ```
@@ -120,7 +123,7 @@ var jsTasks = function(filename) {
var writeToManifest = function(directory) {
return lazypipe()
.pipe(gulp.dest, path.dist + directory)
.pipe($.livereload)
.pipe(browserSync.reload, {stream:true})
.pipe($.rev.manifest, revManifest, {
base: path.dist,
merge: true
@@ -128,13 +131,6 @@ var writeToManifest = function(directory) {
.pipe(gulp.dest, path.dist)();
};
// Start the server
gulp.task('browser-sync', function() {
browserSync({
proxy: "localhost"
});
});
// ## Gulp Tasks
// Run `gulp -T` for a task summary
@@ -147,8 +143,7 @@ gulp.task('styles', function() {
.pipe(cssTasks(dep.name)));
});
return merged
.pipe(writeToManifest('styles'))
.pipe(browserSync.reload({stream:true}));
.pipe(writeToManifest('styles'));
});
// ### Scripts
@@ -203,11 +198,14 @@ gulp.task('clean', require('del').bind(null, [path.dist]));
// ### Watch
// `gulp watch` - recompile assets whenever they change
gulp.task('watch', ['browser-sync'], function() {
gulp.task('watch', function() {
browserSync({
proxy: config.devUrl
});
gulp.watch([path.source + 'styles/**/*'], ['styles']);
gulp.watch([path.source + 'scripts/**/*'], ['jshint', 'scripts', browserSync.reload]);
gulp.watch([path.source + 'scripts/**/*'], ['jshint', 'scripts']);
gulp.watch(['bower.json'], ['wiredep']);
gulp.watch('**/*.php', function () {
gulp.watch('**/*.php', function() {
browserSync.reload();
});
});

View File

@@ -54,15 +54,6 @@ function assets() {
add_filter('script_loader_src', __NAMESPACE__ . '\\jquery_local_fallback', 10, 2);
}
/**
* Livereload client
* https://github.com/livereload/livereload-js
*/
if (WP_ENV === 'development') {
wp_register_script('livereload', 'http://localhost:35729/livereload.js?snipver=1', null, false, true);
wp_enqueue_script('livereload');
}
if (is_single() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}