Skip to content
This repository

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

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 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.