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 );
Written by Eduardo Matos
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Templates
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#