GithubHelp home page GithubHelp logo

handlebars-virtual-dom's Introduction

handlebars-virtual-dom

Compile Handlebars templates to virtual-dom.

Compile this:

<div>
	value1
	{{variable1}}
	{{#if variable2}}<span>value2</span>{{else}}nothing{{/if}}
	<span data-attr="{{#if variable3}}value3{{/if}} value4">value5</span>
</div>

into this:

h("div", [
	"value1",
	context.variable1,
	context.variable2 ? h("span", [
		"value2"
	]) : "nothing",
	h("span", {"data-attr":(context.variable3 ? "value3" : "") + " value4"}, [
		"value5"
	])
);

Usage

Server/Browserify

var handlebarsVirtualDom = require("handlebars-virtual-dom");
var result = new handlebarsVirtualDom(options).compile("<h1>{{title}}</h1>");

AMD/etc

Accessible via define() or window.handlebarsVirtualDom.

Options

See handlebars-html-parser.

handlebars-virtual-dom's People

Contributors

stevenvachon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

handlebars-virtual-dom's Issues

[Question] Progress? Help needed?

Hi there,

I´m actually started working on the same kind of thing. If you already have some code (doesn't need to be something that already works) I would be happy to join efforts & help out.

Cheers
Sebastian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.