Giter VIP home page Giter VIP logo

handlebars-react's Introduction

handlebars-react NPM Version Build Status Dependency Status

Compile Handlebars templates to React.

Compile this:

<div>
	text1
	{{variable1}}
	{{#if variable2}}<span>text2</span>{{else}}text3{{/if}}
	<span data-attr="{{#if variable3}}value1{{/if}} value2">text4</span>
</div>

into this:

React.DOM.div(null,
	"text1",
	this.props.variable1,
	this.props.variable2 ? React.DOM.span(null,
		"text2"
	) : "text3",
	React.DOM.span({"data-attr":(this.props.variable3 ? "value1" : "") + " value2"},
		"text4"
	)
);

Installation

Node.js >= 5 is required; < 5.0 will need an ES6 compiler. Type this at the command line:

npm install handlebars-react

Usage

Server/Browserify

var HandlebarsReact = require("handlebars-react");

new HandlebarsReact(options)
.compile("<h1>{{title}}</h1>")
.then(result => console.log("done!"));

UMD/AMD/etc

Accessible via define() or window.HandlebarsReact.

Options

options.beautify

Type: Boolean
Default value: false
When true, output will be formatted for increased legibility.

options.env

Type: String
Default value: undefined
Option presets for your target environment: "development" or "production". Preset options can be overridden.

options.normalizeWhitespace

Type: Boolean
Default value: false
See handlebars-html-parser.

options.processCSS

Type: Boolean
Default value: false
See handlebars-html-parser.

options.processJS

Type: Boolean
Default value: false
See handlebars-html-parser.

options.useDomMethods

Type: Boolean
Default value: false
When true, available React.DOM convenience functions will be used instead of React.createElement().

Roadmap Features

  • convertHbsComments to JavaScript block comments (or HTML comments?)
  • convertHtmlComments to JavaScript block comments
  • ignoreComments option when React supports such (react#2810)
  • trimWhitespace option to remove spaces between elements (<tag> a word <tag> to <tag>a word<tag>)?

Changelog

  • 0.0.1โ€“0.0.16 pre-releases

handlebars-react's People

Contributors

stevenvachon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

handlebars-react's Issues

Usage

Hey steven
Can you tell me how to use it?? i dont understand very well.... but i already install it with npm

Installation command not working

Getting a 404 error:

npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "handlebars-react" "--save-dev"
npm ERR! node v0.12.5
npm ERR! npm v2.11.2
npm ERR! code E404

npm ERR! 404 Registry returned 404 for GET on http://registry.npmjs.org/handlebars-react
npm ERR! 404
npm ERR! 404 'handlebars-react' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'nautilus'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

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.