definePlugin #

Declares a Generator Plugin that runs while the site is built and served. It only adds types.

Usage #

TypeScript
import { 
definePlugin
} from 'kawapress'
export default
definePlugin
({
name
: 'my-plugin',
setup
(
api
) {
api
.
configResolved
((
site
) => {
console
.
log
(`Building ${
site
.
title
}`)
}) }, })

Parameters

pluginKawaPressPlugin

The plugin: a name and a setup(api) that registers hooks.

namestring

Stable name of the plugin. A site plugin with a preset plugin's name replaces it.

setupGeneratorPluginSetup

Registers the hooks of the plugin.

Returns The same plugin.

Full type signature
TypeScript
function definePlugin(plugin: KawaPressPlugin): KawaPressPlugin

Edit this page

Comments