grunt-required

0.1.2 • Public • Published

grunt-required

A Grunt task for detecting required modules and option to automatically install with npm.

Getting Started

If you haven't used grunt before, be sure to check out the Getting Started guide.

From the same directory as your project's Gruntfile and package.json, install this plugin with the following command:

npm install grunt-required --save-dev

Once that's done, add this line to your project's Gruntfile:

grunt.loadNpmTasks('grunt-required');

If the plugin has been installed correctly, running grunt --help at the command line should list the newly-installed plugin's task or tasks. In addition, the plugin should be listed in package.json as a devDependency, which ensures that it will be installed whenever the npm install command is run.

The "required" task

Overview

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

grunt.initConfig({
  required: {
    libs: {
      options: {
        // npm install missing modules
        install: true
      },
      // Search for require() in all js files in the src folder
      src: ['src/*.js']
    }
  }
});

Options

options.install

Type: Boolean Default value: false

Set to true to have npm install missing required modules.

options.ignore

Type: Array Default value: [ /* list of Node.js core libs */ ]

Specify modules to ignore. By default it will ignore a list of core Node.js modules.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Lint and test your code using grunt.

Release History

  • 0.1.2 - Fix for multiple files (@N9VijayIyer)
  • 0.1.1 - Grunt v0.4 support.
  • 0.1.0 - Initial release.

Readme

Keywords

Package Sidebar

Install

npm i grunt-required

Weekly Downloads

8

Version

0.1.2

License

none

Last publish

Collaborators

  • shama