@kdupress/plugin-register-components (opens new window)
register-components plugin for KduPress
Install
yarn add -D @kdupress/plugin-register-components
# OR npm install -D @kdupress/plugin-register-components
Usage
module.exports = {
plugins: ['@kdupress/register-components']
}
Options
componentsDir
- Type:
Array | String - Default:
[]
All components in this directory will be registered as global components, naming of components will follow the components found in .kdupress/components (opens new window).
module.exports = {
plugins: [
[
'register-components',
{
componentsDir: somepath
}
]
]
}
components
- Type:
{ name: string, path: string } - Default:
[]
Register global components by explicit name and path.
module.exports = {
plugins: [
[
'register-components',
{
components: [
{
name: 'K-Card',
path: 'path/to/card.kdu'
}
]
}
]
]
}
getComponentName
- Type:
(file: string) => string - Default:
file => file.replace(/\/|\\/g, '-')
Customize component names for files under componentsDir.