cft-source

JavaScript source code for the CFT (CoffeeScript fragment template) compiler


License
MIT
Install
gem install cft-source -v 0.0.6

Documentation

CFT: CoffeeScript fragment templates

CFT lets you embed CoffeeScript in your markup. It's a lot like Eco, except it generates Document Fragments instead of strings.

Using document fragments for templates lets you do some interesting things, such as dynamic DOM updation. For example:

<% @observe @post => %>
  <!-- Run whenever post changes -->

  <span><%= @post.get('name') %></span>
<% end %>


<% @observeEach User.all() (user) => %>
  <!-- Run whenever we create/update/change a user -->
  <label>Name: <%= user.name %>
<% end %>