# @whalecloud/cms-plugins

> cms plugins utils

Latest version **0.0.2** (published 2020-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @whalecloud/cms-plugins
pnpm add @whalecloud/cms-plugins
yarn add @whalecloud/cms-plugins
bun add @whalecloud/cms-plugins
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2020-03-23 |
| First published | 2020-03-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | whalecloud-developer |

## Links

- npm: https://www.npmjs.com/package/@whalecloud/cms-plugins
- npm.io page: https://npm.io/package/@whalecloud/cms-plugins

## Dependencies (1)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.5.5

## Recent versions

- 0.0.2 (latest) — 2020-03-23
- 0.0.1 — 2020-03-23

## README

## Install
```
npm install --save @whalecloud/cms-plugins
```

Or if you prefer yarn: 
```
yarn add @whalecloud/cms-plugins
```

## Usage

### Adding a plugin
```
import { registerPlugins } from "@whalecloud/cms-plugins";

// Add a plugin
registerPlugins({
    name: "my-plugin-demo",
    type: "basic-demo",
    render: () => "Hi!"
});

registerPlugins({
    name: "my-plugin-demo2",
    type: "basic-demo",
    render: () => "Hello!"
});
```

### Getting a single plugin by name
```
// anywhere in your app
import { getPlugin } from "@whalecloud/cms-plugins";

const plugin = getPlugin("my-plugin-demo");
plugin.render();
```

### Getting plugins by type
```
// anywhere in your app
import { getPlugins } from "@whalecloud/cms-plugins";

const plugins = getPlugins("basic-demo");
<!-- const plugins = getPlugins(); get all plugins-->
plugins.forEach(plugin => {
    plugin.render();
});
```

### Removing a plugin
```
// anywhere in your app
import { unregisterPlugin } from "@whalecloud/cms-plugins";

unregisterPlugin("my-plugin-demo");
```

---
_Source: https://npm.io/package/@whalecloud/cms-plugins · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
