Tired of those horribly slow templating languages?
Want a super fast templating language that doesn't involve strings?
Do you like your libraries small and simple?
Then DO Not Use This
Why? I'm creating global variables to stop everything from failing (granted I'm unsetting the global variables after doing that but that's still really not clever). Take this for example:
var blinkTag = DONUT(function () {
return blink("Why would you do this?");
});
document.getElementById("mainArea").appendChild(blinkTag);
There's no such thing as a "blink" function. DONUT just catches the exception and creates a temporary one for you.
Tags can have tags and you can also set attributes and inline css:
var list = DONUT(function () {
return ul(
li("Oh the horror!"),
li("Why would one even.."),
li("Hey is that something for inline css").css("color", "red").attr("title", "Oh my god it is"),
li(
"You are the worst ever",
a("No you're making it worse").attr("href", "stop_it_for_the_love_of.html")
)
);
});
Oh right well...:
- It's fast (somewhat)
- It's teeny tiny
- No more messy HTML
- You shouldn't actually use this
- No really, you shouldn't use this
Whatever. Do what you like. Just don't blame me when your new ultra super rockstar startup is on fire because you decided to use this for your javascript templating instead of mustache or plates or something sensible.
I KNOW!!!
Javascript templating is HTML5 maaan (Web 2.0 was so last decade) that means you should have been using FireChrome's Nightcanrary browser.
WHY