node package manager


Template wrapper for hogan - mustache to allow php style templates


Here was the problem.. I want templates that will work in both PHP and NodeJS-ExpressJS..
I like to template in PHP the simple way.. like this..

  $s = "World"
Hello <?=$s?>

Now this template can be used in Express like this..

var  express = require('express')
        ,app = express();
app.set('view engine', 'pjs')
app.engine('pjs', require('./index.js'))
var o = { name:'Chris', greeting:'how are you' }
app.get('/mustache', function(req,res){
    res.render("index-mustache", o);
app.get('/', function(req,res){
    res.render("index-pjs", o);

Mustache can be used instead, but partials are not supported

Templates have an .pjs extension and are in /views

See test.js for examples