Reputation: 8709
I've been looking to use mustache or handlebars and nodejs but I have't been successful to finding a sample project online that is working.
I just need a sample skeleton structure which uses mustache as a templating engine.
My goal is to use nodejs, mustache/handlebars, less (css framework) and some good routing but haven't been able to find a good example to work off.
I created a project which uses less, mustache and express using some tutorial online but I'm getting an error at startup. app.js at https://gist.github.com/1237758
I'm getting TypeError: Object # has no method 'compile'
I have express, less and mustache in my node_modules.
Upvotes: 3
Views: 7625
Reputation: 153
I looked for a Express/Handlebars/Less framework, but couldn't find any templates that I was satisfied with.
I ended up making my own Express/Handlebars/Less project template on GitHub:
Express-Handlebars-Less-Jasmine-NodeUnit_Project-Template
Upvotes: 0
Reputation: 14503
As you have already received some answers with regard to templating I thought I would answer the routing one. Try out http://sammyjs.org/ a small web framework written in js.
Also there are some examples https://github.com/quirkey/sammy/tree/master/examples/
Upvotes: 0
Reputation: 1141
The source of your error seems to reside in connect
module, connect/lib/middleware/compiler.js
but I can't reproduce the error. It is possible that you have an old connect module inside your $NODE_PATH
Upvotes: 0
Reputation: 1612
You can use the stache module. It makes it much easier to use mustache in express. Check out the examples.
Upvotes: 3
Reputation: 13198
Try this:
http://bitdrift.com/post/2376383378/using-mustache-templates-in-express
Upvotes: 5