Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Convert Javascript Templates to Coffeescript for Caching Templates in the Browser
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib/guard
spec
.gitignore
.rspec
MIT-LICENSE
README.md
Rakefile
guard-javascript-template.gemspec

README.md

Guard Javascript Templates

Convert Javascript Templates to Coffeescript for Caching Templates in the Browser

Usage

Install:

gem install guard-javascript-template
guard init javascript-template

Build JavaScript Templates in HAML

-# app/views/posts/_template.js.haml

%li
  %h3 ${title}

Load Generated Javascript File

%script{:src => "/assets/templates.js"}
window.Templates = {
  "posts-template": "<li> \
    <h3>${title}</h3> \
  </li> \
  "
}

Configuration

guard "javascript-template", :var => "$T"
$T = {
  "posts-template": "<li> \
    <h3>${title}</h3> \
  </li> \
  "
}

MIT License. © 2011 Lance Pollard. Free to use for whatever.

Something went wrong with that request. Please try again.