grunt-inject
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-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

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)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (0)
None
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |