STRd6 / jadelet

Pure and simple clientside templates
https://jadelet.com
MIT License
378 stars 11 forks source link

Jade Support #14

Closed DylanPiercey closed 8 years ago

DylanPiercey commented 10 years ago

I love hamlet and have been using it in some little demo's lately and it's integration with coffee-script is top-notch.

However I feel like you could reach a broader audience if you also supported jade templates. Many nodejs developers use jade templates, and I for one even compile jade templates for static sites. I'd love to use hamlet in production however it'd be hard to switch my codebase from jade.

STRd6 commented 10 years ago

Thanks for the feedback. Jade style templates are on my roadmap and the more people who request them the more of a priority it becomes.

Much like with Haml, the Jade support will be a subset of the full Jade language so if there are any code examples of Jade features you definitely need add them to the issue. I'll update this issue with progress as it happens, but not sure how soon it can be "done".

DylanPiercey commented 10 years ago

Similar to haml it would be nice to have jades "each" and perhaps the inline if/else. However I'd be perfectly content to write the template in unberfered code ie: - for elem in list.

Currently I can't get my jade templates to use unbuffered coffeescript but if this was possible it would be a great starting point.

DylanPiercey commented 10 years ago

I may look through the runtime / compiler later today to see if there is any way I can help.

STRd6 commented 10 years ago

One place to start may be https://github.com/inductor-labs/hamlet-parser/blob/master/source/haml.jisonlex

And creating a jade lexer that returns the same tokens. Let me know if you have any trouble and I'll try and update docs to make it easier for contributors.

DylanPiercey commented 10 years ago

Thanks for the resource. Can't say I've ever looked at a lexer before, but I will try to learn as much as I can to eventually help with this. Unfortunately I'm swamped until September but do you have any resources I can look at to learn more about jison and such? I feel like a jade implementation will greatly increase the popularity of the project.

STRd6 commented 8 years ago

This has been in since a while ago, sorry I haven't updated the issue! We're actually using the jade syntax in production on some projects so I think it should be pretty good now.

If you have a templates folder with .jade files in it, then this command will compile them:

./node_modules/.bin/hamlet -d templates -r "require('hamlet.coffee')"