# redoculous

> PHP style templates

Latest version **0.3.3** (published 2017-07-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install redoculous
pnpm add redoculous
yarn add redoculous
bun add redoculous
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.3 |
| Published | 2017-07-03 |
| First published | 2017-06-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Nicholas Clawson |
| Maintainers | nickclaw |
| Keywords | template, async, await, php, documentation, generated |

## Links

- npm: https://www.npmjs.com/package/redoculous
- Repository: https://github.com/nickclaw/redoculous
- Homepage: https://github.com/nickclaw/redoculous#readme
- Issues: http://github.com/nickclaw/redoculous/issues
- npm.io page: https://npm.io/package/redoculous

## Dependencies (5)

- [derf](https://npm.io/package/derf.md) ^2.2.1
- [debug](https://npm.io/package/debug.md) ^2.2.0
- [lodash](https://npm.io/package/lodash.md) ^4.3.0
- [common-tags](https://npm.io/package/common-tags.md) ^1.4.0
- [import-from](https://npm.io/package/import-from.md) ^2.1.0

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 0.3.3 (latest) — 2017-07-03
- 0.3.2 — 2017-07-01
- 0.3.1 — 2017-07-01
- 0.3.0 — 2017-07-01
- 0.2.1 — 2017-06-30
- 0.2.0 — 2017-06-30
- 0.1.2 — 2017-06-28
- 0.1.1 — 2017-06-28

## README

# redoculous [![Build Status](https://travis-ci.org/nickclaw/redoculous.svg?branch=master)](https://travis-ci.org/nickclaw/redoculous)

An async template library in the style of PHP. [Try it out!](https://npm.runkit.com/redoculous)
 - Use the entire power of the node runtime.
 - Handle asynchronous code easily with `await`
 - Identify errors fast with [accurate stack traces](/test/blame.test.js).

### Example

```js
import render from 'redoculous';
import fs from 'fs';

const path = '/path/to/template.md.doc';
const raw = fs.readFileSync(path);

render({
  template: raw,
  filepath: path,
  globals: { foo: 'bar' }
}).then(
  text => console.log(text),
  err => console.error(err),
);
```

### API

##### `render(options: Object) -> Promise<String>`
Process a template into text. Takes the following options:
 - `template: String` the template to render
 - `filepath: String` where to resolve `require` from
 - `globals: ?Object` the initial variables your template can use

### Syntax

```php
<?doc
// you have a full node environment to play around in
const foo = "World";
const bar = require("./module");
?>

# Interpolate exported values easily with: <?= foo ?>


<?doc
// all code is run inside an async function
const result = await new Promise(res => setTimeout(
  res,
  500,
  "value"
));
?>

The result is <?= result ?>


<?doc
// you can also interpolate code and text
for (let i = 0; i < 10; i++) { ?>
repeating <?= i ?> times
<?doc } ?>

```

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