metalsmith-loader
v0.1.1
Published
Loads Metalsmith as well as metalsmith plugins using globbing patterns similar to `load-grunt-task`
Downloads
3
Maintainers
Readme
metalsmith-loader
Loads Metalsmith as well as multiple metalsmith plugins using globbing patterns
This plugin takes reference from / works similarly to load-grunt-task
, allowing you to read the dependencies
/devDependencies
/peerDependencies
in your package.json and load metalsmith plugins that matches the provided patterns.
Usually you would have to load each plugin one by one, which is unnecessarily cumbersome.
That aside, it also gives an option to load metalsmith library itself.
Before
var Metalsmith = require('metalsmith');
var drafts = require('metalsmith-drafts');
var permalinks = require('metalsmith-permalinks');
var collections = require('metalsmith-collections');
After
require('metalsmith-loader')();
Install
Install with npm: npm install --save-dev metalsmith-loader
Simplest use case:
var config = require('metalsmith-loader')();
Metalsmith(__dirname).use(config.collections());
or if you want it global:
require('metalsmith-loader')({global: true);
Metalsmith(__dirname).use(collections());
To specify additional options:
require('metalsmith-loader')({
core: true,
pattern: 'metalsmith-*',
config: '../package.json',
scope: 'devDependencies',
global: true
});
Options
core
(optional)
Type: boolean
Default: false
Determines if metalsmith should be loaded.
pattern
(optional)
Type: String|Object
Default: metalsmith-*
By default metalsmith-*
will be used as the globbing pattern.
config
(optional)
Type: String|Object
Default: Path to nearest package.json
scope
(optional)
Type: String|Array
Default: ['dependencies', 'devDependencies', 'peerDependencies']
global
(optional)
Type: boolean
Default: false
Determines if plugin should require modules into the global variable environment or put the modules into a return object / dictionary.