Skip to content

A Browserify middleware that pre-compiles Jade templates on the server and uses the light-weight Jade runtime made for the browser to render them on the client.

Notifications You must be signed in to change notification settings

loku/browserijade

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Browserijade

A Browserify middleware that pre-compiles Jade templates on the server and uses the light-weight Jade runtime made for the browser to render them on the client. Can be used to include jade files in the Browserify bundle or just to render pre-compiled templates on the client if for example templates are being AJAXed to the client.

Build Status

Installation

$ npm install browserijade

Running the tests

$ npm test

Example

Including all Jade templates with a connect-based framework like Express

Server-side:

var browserify = require("browserify"),
	browserijade = require("browserijade")

var bundle = browserify()
bundle.use(browserijade(__dirname + "/views"), ['serverThing.jade'], {debug: true})

app.use(bundle)

Client-side:

var browserijade = require("browserijade")

var article = browserijade("article", {title: "NEWS!"})
$("body").html(article)

Just rendering templates on the client-side without including any templates

Server-side:

var browserify = require("browserify")
var bundle = browserify()
app.use(bundle)

Client-side:

var browserijade = require("browserijade").renderString

// articleTemplate is a pre-compiled Jade template that could
// have been AJAXed to the client.
var article = browserijade(articleTemplate, {title: "NEWS!"})
$("body").html(article)

About

A Browserify middleware that pre-compiles Jade templates on the server and uses the light-weight Jade runtime made for the browser to render them on the client.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%