Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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