Project

reco

0.0
No commit activity in last 3 years
No release in over 3 years
Reco let you compile Eco templates into Javascript through Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

Reco: Ruby port of the Eco template compiler.

Eco is a wonderful javascript template system by Sam Stephenson. For more information about Eco visit its github page.

Reco let you compile Eco templates into Javascript through Ruby like this:

javascript = Reco.compile File.read('some_template')

With Rails 3.1 you can serve Eco templates i.e. like this:

// app/assets/javascripts/templates.js.erb
window.templates = {};
<% for template_name in [:user, :post] do %>
  <% template_path = File.join Rails.root, 'app', 'assets', 'templates', "#{template_name}.eco" %>
  <%= Reco.compile File.read(template_path), identifier: "window.templates.#{template_name}" %>
<% end %>

Javascript that are run after templates.js.erb will now be able to do this:

window.templates.user({ name: 'Rasmus' }); // returns the rendered HTML