plop.load can be used to load generators, actionTypes, helpers, and partials from a other plopfiles that are in your project or on NPM (plop-pack). Example code below.
String or Array<String>targets is the location or locations of the plopfile(s) to be loaded. These locations can be file paths (absolute or relative to the current plopfile) or the node module name of the plop-pack that should be loaded.
Objectconfig is an object that can be passed to the plopfile or plop-pack when they are run. This allows the consumer of the plopfile or plop-pack to configure certain aspects of its functionality. To know what properties should be in this object, see the documentation provided by the author.
Object{ generators:true, helpers:false, partials:false, actionTypes:false }include is an object that can contain 4 properties (generators, helpers, partials, and actionTypes). Each of these properties should have an IncludeDefinition as its value. Most of the time this object is not needed because the plopfile or plop-pack is able to specify a default IncludeDefinition to be used.
IncludeDefinitiontrue will include all assets, false will include non of them.load via a path
// loads all 5 generators, no helpers, actionTypes or partials (even if they exist)
plop.load('./plopfiles/component.js');
load via a path with a custom include config
// loads all helpers, no generators, actionTypes or partials (even if they exist)
plop.load('./plopfiles/component.js', {}, { helpers: true });
load via a path with a limited include
// loads only the "js-header" helper, no generators, actionTypes or partials (even if they exist)
plop.load('./plopfiles/component.js', {}, { helpers: ['js-header'] });
load via a path with config object
// the component.js module will receive the config object and do something
// example: it could use it to alter which templates it will use (es6)
// and prefix all generator names with 'foo'
plop.load('./plopfiles/component.js', { es6: true, namePrefix: 'foo' });
load via npm module
this module configures a default include definition
// loads all 3 helpers
plop.load('plop-pack-fancy-comments');
};
load via npm module with a renaming include config
// loads only the header helper, no generators, actionTypes or partials (even if they exist)
// within the plopfile and templates, the "js-header" helper is referenced as "titleComment"
plop.load('plop-pack-fancy-comments', {}, { helpers: {'js-header': 'titleComment'} });
load via npm module AND path
// uses the default include config for each item
plop.load([
'plop-pack-fancy-comments',
'./plopfiles/component.js'
]);