grunt-inject-comment

0.1.2 • Public • Published

grunt-inject-comment

Inject a comment at the end of your html and js files

Getting Started

This plugin requires Grunt ~0.4.4

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, you may install this plugin with this command:

npm install grunt-inject-comment --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-inject-comment');

The "inject_comment" task

Overview

In your project's Gruntfile, add a section named inject_comment to the data object passed into grunt.initConfig().

grunt.initConfig({
  inject_comment: {
    options: {
      // Task-specific options go here.
    },
    files: {
      // Target-specific file lists and/or options go here.
	  //format is --> 'src': ['file1.html', 'file2.html', ...]
    },
  },
});

Options

options.type

Type: String Default value: 'html' Allowed values : 'html', 'js'

An indicator used by the plugin to add the comment in an html or a js files.

options.value

Type: String Default value: my comment

The value of the comment that you want to add in your files.

Usage Examples

Default Options

In this example, '// The comment to add' will be added at the end of all js files described in the 'src' fields.

grunt.initConfig({
  inject_comment: {
   options: {
		type: 'js',
		value: 'The comment to add'
	},
    files: {
      'src': ['src/testing.js', 'src/ctrl/*.js']
    }
  },
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

2014-03-14 // V 0.1 // First release

Package Sidebar

Install

npm i grunt-inject-comment

Weekly Downloads

20

Version

0.1.2

License

none

Last publish

Collaborators

  • loher