Core Plugins
Handles the registration of installed plugins.
Installation
npm install nodewrite-core-plugins --save
This is a core package and is installed by default.
Usage
The file structure for a plugin:
.
├── /config
| └── default.yml
├── /assets
├── /models
├── /public
├── /test
├── /views
| ├── /helpers
| ├── /layouts
| └── /partials
├── README.md [required]
├── icon.png
├── index.js [required]
└── package.json [required]
Helper Methods
server.getPluginRegistry(callback)
server.getPluginReadMe(name, callback)
server.getPlugin(name, callback)
server.getPluginRegistry(callback)
Returns an array of installed plugin objects.
callback
- method to call with a signature offunction(error, plugins)
.error
- any error encountered while trying to read.plugins
- registry array of plugins.
server;
Resulting registry array:
package: name: "nodewrite-plugin-stripe" version: "1.0.0" description: "stripe plugin for nodewrite" // package.json .. short: name: "plugin-stripe" url: "/plugins/stripe" // etc ...
server.getPluginReadMe(name, callback)
Returns contents of a plugin's README.md
file.
name
- plugin name of package to read.callback
- method to call with a signature offunction(error, source)
.error
- any error encountered while trying to read.source
- contents of pluginREADME.md
file.
server;
Resulting content is the raw markdown:
## Stripe Pluginetc ...
server.getPlugin(name, callback)
Returns a single plugin object from the installed plugins registry.
name
- plugin name of package to read.callback
- method to call with a signature offunction(error, plugin)
.error
- any error encountered while trying to read.plugin
- registry object for plugin.
server;
Resulting plugin registry object:
package: name: "nodewrite-plugin-stripe" version: "1.0.0" description: "stripe plugin for nodewrite" // package.json .. short: name: "plugin-stripe" url: "/plugins/stripe"
Getting Help
Open an issue on this repository!