Skip to content

Instantly share code, notes, and snippets.

@nwwells
Created March 12, 2014 03:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nwwells/9500088 to your computer and use it in GitHub Desktop.
Save nwwells/9500088 to your computer and use it in GitHub Desktop.
LiveReload of Express Server
grunt.registerTask('delayed-livereload', 'Live reload after the node server has restarted.', function () {
var done = this.async();
setTimeout(function () {
request.get('http://localhost:' + reloadPort + '/changed?files=' + files.join(','), function(err, res) {
var reloaded = !err && res.statusCode === 200;
if (reloaded)
grunt.log.ok('Delayed live reload successful.');
else
grunt.log.error('Unable to make a delayed live reload.');
done(reloaded);
});
}, 500);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment