1
0
mirror of https://github.com/bobwen-dev/react-templates synced 2025-04-12 00:56:39 +02:00
2014-11-13 00:25:12 +02:00
2014-11-11 11:18:34 +02:00
2014-11-10 12:55:24 +02:00
2014-11-10 17:30:46 +02:00
2014-11-10 12:47:49 +02:00
2014-11-11 11:27:59 +02:00

react-templates

Light weight templates for react. Reasons that we love it:

  • No runtime libraries. No magic. Just simple pre-compilation to a clear code
  • Super easy to write panels. By panels we mean components that have a lot of HTML code and non-reusable logic
  • Very good separation of presentation and logic. Almost no HTML within the component file
  • Declerative coding for presentation. HTML that you write and inspect look similar
  • Easy syntax. Similar to HTML. All IDEs recognize this format

How does it work

React templates compiles a *.rt file (react template - extended HTML format) into a javascript file. Currently, this file supports requirejs format, that will return a function. This function, when applied, will return a virtual react DOM (based on React.DOM elements and user custom components). A common use case would be that a React component would require a JS file generated by a template, and then call func.apply(this), causing the template to have the component as its context.

Basic concepts for react templates:

  • Any valid HTML is a template (and comments)
  • {} to identify JS execution context
  • rt-if
  • rt-repeat
  • rt-scope
  • rt-class
  • style
  • event handlers
  • doctype rt, require dependencies, and calling other components
Description
Light weight templates for react
Readme 6 MiB
Languages
JavaScript 92.7%
CSS 5.9%
HTML 1.3%
TypeScript 0.1%