开发者

nodejs mustache/handlebars example project

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.

UPDATE

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开发者_JAVA技巧.com/1237758

I'm getting TypeError: Object # has no method 'compile'

I have express, less and mustache in my node_modules.


Try this:

http://bitdrift.com/post/2376383378/using-mustache-templates-in-express


You can use the stache module. It makes it much easier to use mustache in express. Check out the examples.


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


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/


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜