Skip to content

Instantly share code, notes, and snippets.

@gr2m
Forked from tissak/package.json
Created February 1, 2012 09:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gr2m/1716130 to your computer and use it in GitHub Desktop.
Save gr2m/1716130 to your computer and use it in GitHub Desktop.
Handlebars support in Spine

NOTE: this is not working yet. It's a work in progress

Spine & Handlebars

  • Mod the package.json file to include handlebars
  • run the "npm install ." command to install the lib
  • Modify the slug.json to include handlebars to provide the lib
  • Add the slug.js to the root folder of the app to load up handlebars support

running hem server should now support finding .handlebars files in the view folder

{
"name": "app",
"version": "0.0.1",
"dependencies": {
"serveup": "~0.0.2",
"hem": "~0.1.6",
"es5-shimify": "~0.0.1",
"json2ify": "~0.0.1",
"jqueryify": "~0.0.1",
"spine": "~1.0.5",
"handlebars": "latest"
}
}
var hem = new (require('hem'));
var Handlebars = require('handlebars');
var fs = require('fs');
var argv = process.argv.slice(2);
hem.compilers.handlebars = function(path) {
var content = fs.readFileSync(path, 'utf8')
var template = Handlebars.compile(content)
return "module.exports = ("+template.toString()+")"
};
hem.exec(argv[0]);
{
"dependencies": [
"es5-shimify",
"json2ify",
"jqueryify",
"spine",
"spine/lib/local",
"spine/lib/ajax",
"spine/lib/route",
"spine/lib/tmpl",
"spine/lib/manager",
"handlebars"
],
"libs": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment