Skip to content

Commit

Permalink
Merge pull request #5 from sleeper/changed_files
Browse files Browse the repository at this point in the history
Updated for last version of grunt-regarde (v0.1.1)
  • Loading branch information
sindresorhus committed Jan 31, 2013
2 parents 1229f2a + 6f80295 commit 3399162
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tasks/livereload.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,25 @@ var server;

module.exports = function (grunt) {
grunt.registerTask('livereload', 'Inform the browser some files have changed', function () {
var files = this.args;
var files;

if (!server) {
grunt.log.error('Server is not started. Please do call livereload-start prior to any other task.');
return;
}

if (!grunt.regarde) {
grunt.log.error('Seems like this task has not been triggered by grunt-regarde.');
return;
}

if (grunt.regarde.changed.length === 0) {
grunt.log.verbose.writeln('No file changed.');
return;
}

files = grunt.regarde.changed;

grunt.log.verbose.writeln('... Reloading ' + grunt.log.wordlist(files) + ' ...');
server.changed({
body: {
Expand Down

0 comments on commit 3399162

Please sign in to comment.