pjs-node

Template wrapper for hogan - mustache to allow php style templates

npm install pjs-node
5 downloads in the last week
17 downloads in the last month

pjs-node

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..

some.php
<?
  $s = "World"
?>

Hello <?=$s?>

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

app.js
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);
})

app.listen(3000)

Mustache can be used instead, but partials are not supported

Templates have an .pjs extension and are in /views

See test.js for examples

npm loves you