Project

eco

0.22
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Ruby Eco is a bridge to the official JavaScript Eco compiler.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Ruby Eco

Ruby Eco is a bridge to the official Eco compiler for embedded CoffeeScript templates.

require "eco"

Eco.compile(File.read("template.eco"))
# => "function(...) {...}"

context = Eco.context_for("Hello <%= @name %>")
context.call("render", :name => "Sam")
# => "Hello Sam"

Eco.render("Hello <%= @name %>", :name => "world")
# => "Hello world"

Installation

$ gem install eco

Dependencies

This library depends on the eco-source gem which is updated any time a new version of Eco is released. (The eco-source gem's version number is synced with each official Eco release.) This way you can build against different versions of Eco by requiring the correct version of the eco-source gem.

In addition, you can use this library with unreleased versions of Eco by setting the ECO_SOURCE_PATH environment variable:

export ECO_SOURCE_PATH=/path/to/eco/dist/eco.js

Ruby CoffeeScript

The Ruby CoffeeScript library is used to load the CoffeeScript compiler source. See the README for information on loading a specific version of the CoffeeScript compiler.

ExecJS

The ExecJS library is used to automatically choose the best JavaScript engine for your platform. Check out its README for a complete list of supported engines.