Grunt task to inject scripts during development
Last updated 7 years ago by chriswren .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install grunt-inject 
SYNC missed versions from official npm registry.


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:



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


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

Current Tags

  • 0.1.1                                ...           latest (7 years ago)

3 Versions

  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
  • 0.0.0                                ...           7 years ago
Maintainers (1)
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (0)
Dev Dependencies (7)
Dependents (0)

Copyright 2014 - 2016 © |