https://github.com/strd6/tempest
Templating that doesn't blow.
https://github.com/strd6/tempest
Last synced: 11 months ago
JSON representation
Templating that doesn't blow.
- Host: GitHub
- URL: https://github.com/strd6/tempest
- Owner: STRd6
- Created: 2013-08-04T19:42:37.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-11-24T00:31:37.000Z (over 12 years ago)
- Last Synced: 2025-06-27T19:09:59.463Z (about 1 year ago)
- Language: CoffeeScript
- Size: 826 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/STRd6/tempest)
Tempest
=======
[Demo](http://strd6.github.io/tempest)
Tempest uses HamlJr with Observable models to provide automagic HTML template data binding.
HamlJr is similar to haml-coffee. They both use CoffeeScript for the scripting language,
they both run in the browser, and they both output executable JavaScript. The difference is
that HamlJr templates are automatically aware of observable properties and can set up bindings
for you.
template.haml >> HAMLjr >> template.js
Templates are functions that return HTML based on the properties of an object they are given.
Many existing templating engines return a string of text or characters but because HamlJr is
native to the browser HamlJr templates return document fragments.
template(object) # => DocumentFragment
Invoking a template by passing a normal object works fine. The real magic comes when passing
an object that has observable properties.
objectWithObservableProperties =
name: Observable "HamlJr"
template(objectWithObservableProperties)
# Set a new value
objectWithObservableProperties.name("Yolo")
# Any node referencing this observable is automatically updated
A simple data object can be automatically made into an observable model:
observableModel = Model(data).observeAll()
Setup
=====
In the tempest folder run
npm install
script/demo
in the directory gh-pages run
nserver
go to localhost:8000 in your browser