Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stevenvachon/handlebars-virtual-dom
Compile Handlebars templates to virtual-dom.
https://github.com/stevenvachon/handlebars-virtual-dom
handlebars handlebars-html-parser nodejs vdom virtual-dom
Last synced: 21 days ago
JSON representation
Compile Handlebars templates to virtual-dom.
- Host: GitHub
- URL: https://github.com/stevenvachon/handlebars-virtual-dom
- Owner: stevenvachon
- Created: 2015-01-11T18:48:56.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-01T23:07:38.000Z (almost 10 years ago)
- Last Synced: 2024-10-04T17:26:59.577Z (about 1 month ago)
- Topics: handlebars, handlebars-html-parser, nodejs, vdom, virtual-dom
- Homepage:
- Size: 148 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# handlebars-virtual-dom
> Compile Handlebars templates to [virtual-dom](https://github.com/Matt-Esch/virtual-dom/).Compile this:
```handlebars
value1
{{variable1}}
{{#if variable2}}value2{{else}}nothing{{/if}}
value5
```
into this:
```js
h("div", [
"value1",
context.variable1,
context.variable2 ? h("span", [
"value2"
]) : "nothing",
h("span", {"data-attr":(context.variable3 ? "value3" : "") + " value4"}, [
"value5"
])
);
```## Usage
### Server/Browserify
```js
var handlebarsVirtualDom = require("handlebars-virtual-dom");
var result = new handlebarsVirtualDom(options).compile("{{title}}
");
```
### AMD/etc
Accessible via `define()` or `window.handlebarsVirtualDom`.## Options
See [handlebars-html-parser](https://github.com/stevenvachon/handlebars-html-parser).