0.1.1 • Published 10 years ago
grunt-inject v0.1.1
grunt-inject
Grunt task to inject scripts during development. Great for use with livereload and other snippets to clear Cookies or localStorage.
Getting Started
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, install this plugin with this command:
npm install grunt-inject --save-dev
Then add this line to your project's Gruntfile.js
gruntfile:
grunt.loadNpmTasks('grunt-inject');
Documentation
Here is the config to inject a script into a page:
inject: {
dev: {
htmlSrc: 'src/index.html',
scriptSrc: 'build/setup.js',
htmlDest: 'dev/index.html'
}
}
Required properties
htmlSrc
Type: String
The html source file which contains the following comment to be replaced by the script:
<!--inject-->
scriptSrc
Type: String
The script to be injected into the page.
htmlDest
Type: String
The location where the injected html file is output.
Changelog
0.0.0 - Initial release