From 573a43b02b422560d7a05bd4cc6ad03334a728d6 Mon Sep 17 00:00:00 2001 From: Simon Lepel Date: Tue, 23 Dec 2014 17:30:58 +0100 Subject: [PATCH] update readme --- README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9841fe2..29c244b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ auto-plug ========= - > Auto-require plugins packages by prefix. (for i.e. Gulp, Grunt or other + > Auto-require plugins packages by prefix. (for i.e. [Gulp](https://github.com/gulpjs/gulp), [Grunt](https://github.com/gruntjs/grunt) or other > heavy plugin-dependant packages) [![npm Package Version](https://img.shields.io/npm/v/auto-plug.svg?style=flat-square)](https://www.npmjs.com/package/auto-plug) @@ -22,12 +22,12 @@ $ npm install auto-plug ## Usage -***auto-plug*** will return a object containing the required module exports. If your config data contains package names like `foo-this` and `foo-that`, they can be autoloaded by passing the prefix `foo` and after that accessed by `plugins.this()`or `plugins.that()`. +***auto-plug*** will return a object containing the required module exports. If your config data contains package names like `foo-this` and `foo-that`, they can be auto-loaded by `plugins = require('auto-load')('foo')` and then accessed by `plugins.this()`or `plugins.that()`. You can do this: ``` javascript -var plugins = require('auto-plug')('myprefix'); +var plugins = require('auto-plug')('foo'); ``` or that: @@ -93,6 +93,16 @@ var metalsmith = require('metalsmith') ``` +### Tip + +If you already loaded your package.json's data, pass it as config option to speed up things: + +``` javascript +var pkg = require(process.cwd() + '/package.json'), + plugins = require('auo-plug')({ prefix: 'foo', config: pkg }); +``` + + ## Options All options are optional.