Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jonschlinkert/load-plugins

Thin wrapper around resolve-dep for loading plugins from node_modules or local directories. Like load-gulp-plugins, match dep, etc, but works for gulp, grunt, assemble, verb or anything other task runner or build system that uses plugins.
https://github.com/jonschlinkert/load-plugins

assemble build config glob grunt gulp plugins

Last synced: 2 months ago
JSON representation

Thin wrapper around resolve-dep for loading plugins from node_modules or local directories. Like load-gulp-plugins, match dep, etc, but works for gulp, grunt, assemble, verb or anything other task runner or build system that uses plugins.

Awesome Lists containing this project

README

        

# load-plugins [![NPM version](https://badge.fury.io/js/load-plugins.svg)](http://badge.fury.io/js/load-plugins) [![Build Status](https://travis-ci.org/jonschlinkert/load-plugins.svg)](https://travis-ci.org/jonschlinkert/load-plugins)

> Load plugins for gulp, grunt, assemble, verb any node.js app that needs to load plugins from node_modules or local folders.

## Install

Install with [npm](https://www.npmjs.com/)

```sh
$ npm i load-plugins --save
```

## Usage

### with gulp

```js
var plugin = require('load-plugins')('gulp-*');

gulp.task('default', function () {
gulp.src('test/*.js')
.pipe(plugin.jshint());
.pipe(plugin.mocha());
});
```

### with assemble

```js
var plugin = require('load-plugins')('assemble-*');

assemble.task('default', function () {
assemble.src('templates/*.hbs')
.pipe(plugin.paginate());
.pipe(plugin.collections());
.pipe(assemble.dest('dist/'));
});
```

### with verb

```js
var plugin = require('load-plugins')('verb-*');

verb.task('default', function () {
verb.src('docs/*.md')
.pipe(plugin.toc());
.pipe(plugin.reflinks());
.pipe(verb.dest('./'));
});
```

## Options

See [resolve-dep](https://github.com/jonschlinkert/resolve-dep) for additional options.

### options.require

Pass a custom function for `require`ing files.

```js
plugins('gulp-*', {
require: function(filepath) {
// do stuff to filepath
}
});
```

### options.camelize

Make plugin names camelcased. By default this is `true`.

### options.rename

Pass a rename function to change how plugins are named.

```js
plugins('my-plugins-*', {
rename: function (filepath) {
return path.basename(filepath);
}
});
```

### options.strip

Omit strings from plugin names. This is a complement to the `.rename()` option, it's easiest to understand by way of example:

```js
plugins('gulp-*', {strip: 'gulp'});
```

Returns `{mocha: [Function]}` instead of `{'gulp-mocha': [Function]}`, and so on.

You may also pass an array of strings to strip, or use **braces**, e.g.:

```js
// note that the `strip` option doesn't work with full glob patterns, just braces
plugins('{foo,bar}-*', {strip: ['foo', 'bar']});
```

## Related

* [load-templates](https://github.com/jonschlinkert/load-templates): Load templates.
* [plugins](https://github.com/jonschlinkert/plugins): Run a string through a plugin stack.

## Running tests

Install dev dependencies:

```sh
$ npm i -d && npm test
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/load-plugins/issues/new)

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2014-2015 [Jon Schlinkert](https://github.com/jonschlinkert)
Released under the MIT license.

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 05, 2015._