Grunt task to inject scripts during development


Grunt task to inject scripts during development. Great for use with livereload and other snippets to clear Cookies or localStorage.

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:


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'

Type: String

The html source file which contains the following comment to be replaced by the script:


Type: String

The script to be injected into the page.

Type: String

The location where the injected html file is output.


0.0.0 - Initial release