load-flit-plugins
v0.0.1
Published
Load multiple flit plugins using globbing patterns, inspired from load-grunt-tasks.
Downloads
16
Readme
load-flit-plugins
Load multiple flit plugins using globbing patterns
Usually you would have to load each task one by one, which is unnecessarily cumbersome.
This module will read the dependencies
/devDependencies
/peerDependencies
in your package.json and load flit plugins that match the provided patterns.
Before
flit.loadNpmPlugins('flit-plugin-flightplan');
flit.loadNpmPlugins('flit-xxx');
After
require('load-flit-plugins')(flit);
Install
$ npm install --save-dev load-flit-plugins
Example config
// flitfile.js
module.exports = function (flit) {
// load all flit plugins matching the `flit-*` pattern
require('load-flit-plugins')(flit);
flit.init({});
flit.task('default', []);
}
Usage examples
Load all flit plugins
require('load-flit-plugins')(flit);
Equivalent to:
require('load-flit-plugins')(flit, {pattern: 'flit-*'});
Load all flit-contrib plugins
require('load-flit-plugins')(flit, {pattern: 'flit-contrib-*'});
Load all flit-contrib plugins and another non-contrib task
require('load-flit-plugins')(flit, {pattern: ['flit-contrib-*', 'flit-xxx']});
Load all flit-contrib plugins excluding one
You can exclude plugins using the negate !
globbing pattern:
require('load-flit-plugins')(flit, {pattern: ['flit-contrib-*', '!flit-contrib-xxx']});
Set custom path to package.json
require('load-flit-plugins')(flit, {config: '../package'});
Only load from devDependencies
require('load-flit-plugins')(flit, {scope: 'devDependencies'});
Only load from devDependencies
and dependencies
require('load-flit-plugins')(flit, {scope: ['devDependencies', 'dependencies']});
All options in use
require('load-flit-plugins')(flit, {
pattern: 'flit-contrib-*',
config: '../package.json',
scope: 'devDependencies'
});
Options
pattern
Type: String
, Array
Default: 'flit-*'
(globbing pattern)
config
Type: String
, Object
Default: Path to nearest package.json
scope
Type: String
, Array
Default: ['dependencies', 'devDependencies', 'peerDependencies']