Skip to content

Ruby wrapper around the JavaScript haml-coffee compiler

License

Notifications You must be signed in to change notification settings

huetsch/ruby-haml-coffee

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ruby-haml-coffee

ruby-haml-coffee wraps haml-coffee to generate JavaScript templates from HAML files using CoffeeScript instead of Ruby for the inline code.

The following features are provided:

  • Basic compiler in HamlCoffee.compile to compile source directly to JavaScript
  • Template for Tilt
  • Rails Engine for use with the 3.1 asset pipeline

As a Rails 3.1 Engine

To install, add ruby-haml-coffee to your Gemfile:

group :assets do
  ...
  gem 'ruby-haml-coffee'
  ...
end

Now create template files somewhere in app/assets/javascripts with the extension .js.haml-coffee. Templates are added to the window.HAML object according to their path. For example, app/assets/javascripts/templates/user/show.js.haml-coffee is accessible through window.HAML.templates.user.show:

//= require_tree ./templates

$(function() {
  user = getCurrentUser();

  $(body).append(HAML.templates.user.show(user));
});

About

Ruby wrapper around the JavaScript haml-coffee compiler

Resources

License

Stars

Watchers

Forks

Packages

No packages published