Skip to content

Latest commit

 

History

History

load-grunt-tasks

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

readme.md

load-grunt-tasks Build Status

Load multiple grunt tasks using globbing patterns

Usually you would have to load each task one by one, which is unnecessarily cumbersome.

This module will read the devDependencies in your package.json and load the tasks that matches your patterns.

Before

grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-recess');
grunt.loadNpmTasks('grunt-sizediff');
grunt.loadNpmTasks('grunt-svgmin');
grunt.loadNpmTasks('grunt-styl');
grunt.loadNpmTasks('grunt-php');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-bower-requirejs');

After

require('load-grunt-tasks')(grunt);

Install

Install with npm: npm install --save-dev load-grunt-tasks

Example

// Gruntfile.js
module.exports = function (grunt) {
	// load all grunt tasks matching the `grunt-*` pattern
	require('load-grunt-tasks')(grunt);

	grunt.initConfig();
	grunt.registerTask('default', []);
}

By default grunt-* will be used as the globbing pattern.

You can optionally specify a pattern or an array of patterns:

require('load-grunt-tasks')(grunt, 'grunt-shell');
require('load-grunt-tasks')(grunt, 'grunt-contrib-*');
require('load-grunt-tasks')(grunt, ['grunt-contrib-*', 'grunt-shell']);

You also have the option to specify the package.json as an object if it's not in the same folder as your Gruntfile:

require('load-grunt-tasks')(grunt, 'grunt-shell', require('../package'));

License

MIT License • © Sindre Sorhus