toprope

A mustache template compiler and render helper for express

TopRope

A handlebars template compiler for directories using hogan.js, and renderer for express.

npm install toprope

TopRope is meant to be used in conjunction with express to render your compiled templates to a view in an isolated script tag.

express = require "express"
topRope = require "toprope"

myApp = express()

topRope process.cwd() + "/public/templates", (err, scriptTag) ->
  app.listen 3000, (err) -> 
    console.log "Listening on 3000, Ctrl-C to exit"

This will compile all the templates in your /public/templates directory.

<script src="http://twitter.github.com/hogan.js/builds/2.0.0/hogan-2.0.0.js"></script>
!= templates()

This will output a <script> tag containing the APPLICATION_TEMPLATES variable with your templates.

var hoganed = new Hogan.Template(APPLICATION_TEMPLATES["someTemplate.hbs"]),
    html = hoganed.render({ data: "something" });

First we have to 'Hoganize' the template then call render on it.

Created by Jacob Gable. Licensed under the MIT License; no attribution required.