Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This is an example of setting up a grunt watch task to use grunt-contrib-connect and livereload.
// The rest of the grunt file goes here
watch: {
// The rest of your watch tasks go here
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
// YOUR LIST OF FILES TO WATCH
// 'public/index.html',
// 'public/patterns/*/*.html',
// 'public/css/*.css',
// 'public/js/*.js'
]
}
},
connect: {
options: {
port: 9000,
livereload: 35729,
// Change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
livereload: {
options: {
open: true,
base: [
// 'pathname of your web directory relative to the Gruntfile.js'
]
}
},
},
@joemcgill
Copy link
Author

joemcgill commented Mar 31, 2014

This setup assumes you're ok with using the connect plugin to serve static files via a local node server (which is what connect does). If you need to use livereload with PHP files you should do the whole setup at the watch task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment