Skip to content

Commit

Permalink
Merge pull request #1 from austinpray/guix77-8.0.0
Browse files Browse the repository at this point in the history
Switches from livereload to browsersync
  • Loading branch information
guix77 committed Jan 28, 2015
2 parents cf4f58d + c85d059 commit ff207df
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 28 deletions.
3 changes: 3 additions & 0 deletions assets/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@
"modernizr.js": {
"bower": ["modernizr"]
}
},
"config": {
"devUrl": "example.dev"
}
}
36 changes: 17 additions & 19 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -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:
// ```
Expand Down Expand Up @@ -120,21 +123,14 @@ 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
})
.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

Expand All @@ -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
Expand Down Expand Up @@ -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();
});
});
Expand Down
9 changes: 0 additions & 9 deletions lib/assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit ff207df

Please sign in to comment.