Skip to content

Instantly share code, notes, and snippets.

@stephenhowells
Created January 26, 2014 00:22
Show Gist options
  • Save stephenhowells/8625996 to your computer and use it in GitHub Desktop.
Save stephenhowells/8625996 to your computer and use it in GitHub Desktop.
LiveReload in Both Gulp and Grunt
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
livereload: {
files: ['_site/*'],
options: {
livereload: true
}
},
}
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('default', 'watch');
}
var lr = require('tiny-lr'),
gulp = require('gulp'),
livereload = require('gulp-livereload'),
server = lr();
gulp.task('refresher', function () {
gulp.src('_site/*')
.pipe(livereload(server));
});
gulp.task('watch', function () {
server.listen(35729, function(err) {
if(err) return console.log(err);
});
gulp.watch('_site/*', ['refresher']);
});
gulp.task('default', ['watch']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment