component-lookup
Look for components and gather information about them.
Install
npm install component-lookup
Usage
const componentLookup = require('component-lookup')
componentLookup('*/[^_]*.njk')
componentLookup('*/[^_]*.njk', { cwd: __dirname })
componentLookup('*/[^_]*.njk', { dataPaths: (fileName) => [ `${ fileName }.data.js` ] })
Parameters
-
pattern
{String}
- Files to look for using a glob pattern. -
opts
{?Object}
- Options.-
cwd
{?String}
- Directory in which to look for components. Defaults toprocess.cwd()
. -
dataPaths
{?Function}
- Function that returns an array of paths to tellcomponent-lookup
the location of potential data files.
-
Returns
-
{Object}
- Components and their information.