Last active
August 29, 2015 13:57
-
-
Save joemcgill/9901400 to your computer and use it in GitHub Desktop.
This is an example of setting up a grunt watch task to use grunt-contrib-connect and livereload.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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' | |
] | |
} | |
}, | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.