News for hackers. Stuff that matters.
Re:Pithy.js - An internal DSL for generating HTML in JavaScript by Zelphyr on Wednesday April 03, 2013 @11:29AM (#5486686)
Why is everyone so afraid of HTML that they insist on starting projects like this? I've seen them come and go for 15+ years now and they're never useful. Even less so in the case of using JS to generate HTML because that makes the browser actually work harder.

This isn't a knock against OP or the project creator (if they're not one and the same) because projects like these can be useful exercises. But I would never use something like this in production and I would hope nobody else would either.

Re:Pithy.js - An internal DSL for generating HTML in JavaScript by hellerbarde on Wednesday April 03, 2013 @01:07PM (#5487350)
What do you mean by "afraid of HTML"?

I haven't used this yet, so bear that in mind, but to me this seems to be something that is more expressive than html (I meant String) concatenation. That leads, in my experience, to better maintainability and thus less worries in the future.

Whether this impacts JS performance enough to be a problem, I don't know and don't have the time to test right now.

Edit: words are hard... I accidentally a few of them.

Re:Pithy.js - An internal DSL for generating HTML in JavaScript by grimtrigger on Wednesday April 03, 2013 @12:24PM (#5487046)
I work on an enterprise platform where I have client side access, but no server side access. My only options for injecting HTML are:

1) cross domain AJAX via CORS

2) Injecting HTML strings constructed in JS

For small amounts of HTML, I'd much rather go with option #2.

ps. Its unfortunately very common for developers to have little or no server side access to the applications they're building.

Re:Pithy.js - An internal DSL for generating HTML in JavaScript by crescentfresh on Wednesday April 03, 2013 @12:32PM (#5487090)
Wait, are you rolling up all client templating libraries into 2) or something?
Re:Pithy.js - An internal DSL for generating HTML in JavaScript by grimtrigger on Wednesday April 03, 2013 @12:39PM (#5487148)
My understanding of "client templating libraries" is that they sit on the server, and create code that will be delivered to the client. For example moustache.

If you can easily avoid a call to the server, it might be a good idea.

Re:Pithy.js - An internal DSL for generating HTML in JavaScript by bsimpson on Wednesday April 03, 2013 @05:26PM (#5489234)
Client side templating libraries like Handlebars do in the browser what server side libraries like Jinja do in the cloud.

You've described server-side libraries. Client-side do the exact same thing in JS on the client.