I’d been searching for an evolution of Jade, beyond Jade and its self-imposed limitations, especially around the control of output whitespace.
I came across slm today. Not sure why I haven’t noticed it before.
On github
slm-lang/slm: Slim, Jade like template engine for node
On npm
Sublime Text Package
slm-lang/sublime-slm (only on github, not in Package Control)
Why I like Slm:
- It’s completely done in JavaScript – no dependency on ruby or external libraries.
- It offers better control of white-space around inline tags.
- So far, it matches all functionality in Jade that I can find – I’m not struggling from Jade-withdrawal. Admittedly, I haven’t done a point-by-point comparison.
- It contains all the functionality of Slim that I ever considered using. Admittedly, I never actually tried very hard to use Slim.
What’s missing:
- Tag interpolation
I did just come across a Jade feature that I miss in Slm – in-context creation of additional tags. e.g. span.t1 click #[a(href="go/here") this] link
which, in Jade, produces <span class="t1">click <a href="go/here">this</a> link</span>
.
Slm requires this syntax, so far as I can tell right now:
span.t1
| click
a>(href="go/here") this
| link