Add livereload js snippet to html
This plugin requires Grunt ~0.4.1
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
Because it's not published on npm
yet, add this git repo to your project's package.json
file:
{
"dependencies": {
"grunt-livereload-snippet": "https://github.com/timdouglas/grunt-livereload-snippet/tarball/master"
}
}
Once the plugin has been installed (npm install
), it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-livereload-snippet');
In your project's Gruntfile, add a section named livereload_snippet
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
livereload_snippet: {
//task-specific options
options: {
hostname: 'localhost', //livereload hostname
port: 35729, //livereload port
add: true, //add to file
before: '</body>', //location in document to add snippet, before this string
//or:
after: '<head>', //location in document to add snippet, after this string
},
remove: {
//so you can remove the script snippet...
options: {
add: false
},
src: ['path/to/file.ext']
},
},
})
Type: String
Default value: localhost
The hostname for your livereload server.
Type: String
Default value: 35729
Port for livereload server.
Type: Boolean
Default value: true
Set this to false to remove the snippet from the file
Type: String
Default value: undefined
If either is set, adds snippet before or after specified location in document. Otherwise, just adds snippet to end of file.
(Nothing yet)