Serenade.js template syntax

50 views
Skip to first unread message

Magnus Holm

unread,
Feb 8, 2012, 8:41:26 AM2/8/12
to guardians-o...@googlegroups.com
Alright, this is interesting: https://github.com/elabs/serenade.js

It has Slim/Haml-ish syntax, but with some few changes. Most notably,
all literal strings need to be enclosed in quotes:

body
h1 "Hello World"

At first I was like "meh", that's verbose, but then I realized it has
several advantages:

* It makes it very clear what happens to trailing space
* It works well with its logic-less variables: h1 "Hello, " @name
* It works well with functions: - link_to "Foobar" @link
* It works well with standalone text:

p
"Welcome, "
a[href=@link] "Click here for awesomness"

So all in all, I'm surprisingly positive to that syntax…

// Magnus Holm

Reply all
Reply to author
Forward
0 new messages