7dxyyw
Last Updated: February 25, 2016
·
1.007K
· eduardojmatos
Bfcf5c88d40733a45ce754e6ce225a8b

Node, Jade, Asset-Rack and Templates

For use jade templates on client-side.

In package.json:

"dependencies": {
  "express": "*",
  "jade": "*",
  "asset-rack": "*"
}

Installing:

npm install

In your app.js (node app):

var assetRack = require('asset-rack');

var jadeAssets = new assetRack.JadeAsset({
  url: '/views/templates.js',
  dirname: './views/templates'
});

var app = express();

app.configure(function(){
    .
    .
    app.use(jadeAssets);
    .
    .
});

In your script.js, on client side:

var template = Templates['someTemplate']();
$('#someDiv').html( template );
Say Thanks
Respond