https://github.com/nickclaw/redoculous
https://github.com/nickclaw/redoculous
async documentation nodejs template-engine
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/nickclaw/redoculous
- Owner: nickclaw
- License: mit
- Created: 2017-06-21T03:22:36.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-08T17:25:03.000Z (almost 9 years ago)
- Last Synced: 2025-10-25T14:59:59.393Z (8 months ago)
- Topics: async, documentation, nodejs, template-engine
- Language: JavaScript
- Homepage:
- Size: 269 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# redoculous [](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`
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
# Interpolate exported values easily with: = foo ?>
setTimeout(
res,
500,
"value"
));
?>
The result is = result ?>
repeating = i ?> times
```