Hacker News new | ask | show | jobs
by roblabla 3566 days ago
The value is that optimizing would make jade/pug's code more complicated, whereas a generic tool that minimizes html according to these rules would work on whatever preprocessing tool you use (PHP, ejs, erb, handlebars, pug) that spits out HTML.

Do one thing and do it well, pretty much.

EDIT: editting since I can't reply to child post.

The thing is, if jade does it well on its own, then all the other tools won't profit from it. I believe jade should focus on outputting easy to understand, well-indented HTML.

When debugging HTML problems (missing attributes or whatnot) in development, I always disable any kind of minifiers. If jade implements a minified output, it would need to be optional, further increasing complexity.

If minification is a build step, I can just disable that step. Easy peasy.

1 comments

Yes, that all makes sense. But there is also a cost to such a design. To my mind, doing it well means outputting optimized code.

Edit:

Worrying about the fact that Jade/Pug optimizations won't benefit others completely misses the point. Any improvements to its parser wont help anyone else either. The question is how to make the best tool for the job.

Perhaps the inefficiencies of outputting sub-optimal HTML don't matter much in reality. But if optimal html output was easy to do we would expect it to be done, right? So the only question at all worth considering is how difficult it is to achieve optimal HTML output.

My gut tells me that better output can't be that much harder, but I have never looked at the code at all so I may be dead wrong.