# bloggify-template-renderer

> The default template renderer for Bloggify.

Latest version **2.1.2** (published 2020-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install bloggify-template-renderer
pnpm add bloggify-template-renderer
yarn add bloggify-template-renderer
bun add bloggify-template-renderer
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2020-08-09 |
| First published | 2017-01-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 16 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Bloggify |
| Maintainers | ionicabizau |
| Keywords | bloggify, template, renderer, the, default, for |

## Links

- npm: https://www.npmjs.com/package/bloggify-template-renderer
- Repository: https://github.com/Bloggify/template-renderer
- Homepage: https://github.com/Bloggify/template-renderer#readme
- Issues: https://github.com/Bloggify/template-renderer/issues
- npm.io page: https://npm.io/package/bloggify-template-renderer

## Dependencies (8)

- [ul](https://npm.io/package/ul.md) ^5.2.9
- [deffy](https://npm.io/package/deffy.md) ^2.2.2
- [noop6](https://npm.io/package/noop6.md) ^1.0.4
- [set-or-get](https://npm.io/package/set-or-get.md) ^1.2.4
- [safe-r-json](https://npm.io/package/safe-r-json.md) ^1.0.1
- [iterate-object](https://npm.io/package/iterate-object.md) ^1.3.2
- [read-file-cache](https://npm.io/package/read-file-cache.md) ^1.0.0
- [find-file-in-dirs](https://npm.io/package/find-file-in-dirs.md) ^1.0.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.1.2 (latest) — 2020-08-09
- 2.1.1 — 2018-02-12
- 2.1.0 — 2017-09-13
- 2.0.2 — 2017-08-29
- 2.0.0 — 2017-08-23
- 1.0.0 — 2017-01-01

## README

<!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. -->


















# bloggify-template-renderer

 [![Version](https://img.shields.io/npm/v/bloggify-template-renderer.svg)](https://www.npmjs.com/package/bloggify-template-renderer) [![Downloads](https://img.shields.io/npm/dt/bloggify-template-renderer.svg)](https://www.npmjs.com/package/bloggify-template-renderer)







> The default template renderer for Bloggify.

















## :cloud: Installation

```sh
# Using npm
npm install --save bloggify-template-renderer

# Using yarn
yarn add bloggify-template-renderer
```






















## :question: Get Help

There are few ways to get help:



 1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question.
 2. For bug reports and feature requests, open issues. :bug:





## :memo: Documentation


### constructor

BloggifyTemplate
Creates a new instance of `BloggifyTemplate`.

#### Params

- **String** `name`: The name of the template.
- **String** `tmplPath`: The template path.

### constructor

BloggifyTemplateRenderer
Creates a new instance of `BloggifyTemplateRenderer`.

#### Params

- **Object** `bloggify`: The bloggify instance.

### `getTemplate(name, cb)`
Fetch a template by its name.

#### Params

- **String** `name`: The template name.
- **Function** `cb`: The callback function.

### `registerTemplate(name, tmplPath, usePathName, reregister)`
Use this method to register templates.

Usages:

```js
registerTemplate(name, path)
registerTemplate(path)
registerTemplate(index, path)
```

#### Params

- **String** `name`: The template name.
- **String** `tmplPath`: The template path.
- **Boolean** `usePathName`: Wether to use the pathname (in the template cache) or not.
- **Boolean** `reregister`: Wether to enforce the template reregistering.

#### Return
- **BloggifyTemplate** The template object.

### `getRenderer(ext)`
Gets the template renderer for that extension.

#### Params

- **String** `ext`: The renderer extension.

#### Return
- **Function** The renderer function.

### `registerRenderer(ext, func)`
Creates a new renderer.

#### Params

- **String** `ext`: The renderer extension.
- **Function** `func`: The renderer handler.

### `renderInternalServerError(ctx, data, err, cb)`
Renders the 500 server error and logs the error.

#### Params

- **Context** `ctx`: The context.
- **Object** `data`: The template data.
- **Error** `err`: The error to render.
- **Function** `cb`: The callback function.

### `beforeRender(url, method, cb, transType)`
Appends a hook that is executed before rendering the template.

#### Params

- **String** `url`: The render url.
- **String** `method`: The methods of the renderer.
- **Function** `cb`: The callback function.
- **Object** `transType`: The transform type.

#### Return
- **Hook** The new hook will be returned.

### `render(ctx, tmplName, data, cb)`
Renders a template for a given context.

#### Params

- **Context** `ctx`: The context.
- **String** `tmplName`: The template name.
- **Object** `data`: The template data.
- **Function** `cb`: The callback function.














## :yum: How to contribute
Have an idea? Found a bug? See [how to contribute][contributing].
















## :dizzy: Where is this library used?
If you are using this library in one of your projects, add it in this list. :sparkles:

 - `bloggify`











## :scroll: License

[MIT][license] © [Bloggify][website]






[license]: /LICENSE
[website]: https://bloggify.org
[contributing]: /CONTRIBUTING.md
[docs]: /DOCUMENTATION.md

---
_Source: https://npm.io/package/bloggify-template-renderer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
