Skip to content

Commit 0dda6e3

Browse files
committed
bump gulp-livereload for cleaner code
1 parent a3e11e2 commit 0dda6e3

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

index.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ module.exports = function(gulp, userConfig) {
5757
}
5858
}
5959

60+
// start livereload server early
61+
if (isPluginEnabled('livereload'))
62+
$.livereload.listen();
63+
6064
var cdn = config.substituter.cdn || '';
6165
// setup gulp-substituter js and css keys
6266
if (config.substituter) {
@@ -245,21 +249,16 @@ module.exports = function(gulp, userConfig) {
245249
], ['index']);
246250

247251
if (isPluginEnabled('livereload')) {
248-
var liveReloadServer = $.livereload();
249-
250-
var liveReloadHandler = function(file) {
251-
liveReloadServer.changed(file.path);
252-
console.log('[' + chalk.blue('Reload') + '] ' + file.path);
253-
};
252+
$.livereload.listen();
254253

255-
gulp.watch(path.join(config.dist.markupDir, config.dist.markupFiles), liveReloadHandler);
254+
gulp.watch(path.join(config.dist.markupDir, config.dist.markupFiles), $.livereload.changed);
256255

257256
if (!isPluginEnabled('rename')) {
258257
// markup is not changed when rename is disabled, we can livereload
259258
gulp.watch([
260259
path.join(config.dist.scriptDir, config.dist.scriptFiles),
261260
path.join(config.dist.styleDir, config.dist.styleFiles)
262-
], liveReloadHandler);
261+
], $.livereload.changed);
263262
}
264263
}
265264
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"gulp-jscs": "^0.5.0",
4646
"gulp-jshint": "^1.6.1",
4747
"gulp-less": "~1.2.3",
48-
"gulp-livereload": "~1.3.0",
48+
"gulp-livereload": "^2.1.0",
4949
"gulp-load-plugins": "^0.5.0",
5050
"gulp-newer": "~0.3.0",
5151
"gulp-plumber": "~0.6.0",

0 commit comments

Comments
 (0)