Grunt task to inject scripts during development
npm install grunt-injectshell
npm install grunt-inject --save-dev
`Then add this line to your project's
Gruntfile.js gruntfile:`javascript
grunt.loadNpmTasks('grunt-inject');
`Documentation
Here is the config to inject a script into a page:
`js
inject: {
dev: {
htmlSrc: 'src/index.html',
scriptSrc: 'build/setup.js',
htmlDest: 'dev/index.html'
}
}
`$3
#### htmlSrc
Type:
StringThe html source file which contains the following comment to be replaced by the script:
`html
`#### scriptSrc
Type:
StringThe script to be injected into the page.
#### htmlDest
Type:
String`The location where the injected html file is output.
0.0.0 - Initial release