TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A Case for Strongly Typed HTML Templating Languages

7 pointsby geoffhillover 13 years ago

2 comments

pygorexover 13 years ago
FTA:<p>&#62; Is this full type checking overkill?<p>Yes.<p>&#62; But considering the huge number of websites and web applications written every year, and the massive difficulties we consider with browser testing and compatibility, it sure would be nice if web developers no longer had to consider whether their HTML was valid or not, and instead have more time to focus on the things that really matter.<p>As a web developer I can tell you that generating valid HTML is trivial. Even when working with large, multipart systems like Drupal and Wordpress, the developers and plugin writers do a phenomenal job of creating a single, unified DOM. This is remarkable: thousands of individuals can contribute to a project that outputs a single page of perfectly valid HTML and corresponding CSS/JavaScript assets. (This code is not always optimized, but it is valid).<p>Generating valid HTML is a solved problem - even in complex systems. Creating a new templating engine doesn't add any value.<p>The time and aggravation that occurs in web development is as follows: even if I create a perfectly valid &#38; consistent HTML/CSS/JavaScript web page it will not be rendered the same across web browsers. Let me repeat that: <i>as a web developer even if I honor the contract outlined in a specification there is no guarantee that the same contract will be implemented in a consistent fashion across browsers.</i>
robocatover 13 years ago
Templates that are valid HTML are the right answer, unlike most templates which are string based because historically most server side templates have been string based (which I personally detest). No need for yet another template language!<p>An example is <a href="http://batmanjs.org/" rel="nofollow">http://batmanjs.org/</a> , and maybe most XML based templates too.<p>I ended up writing my own pure HTML templates (templates implemented using cloning - super simple and fast), with declarative definitions written in JavaScript. Declarative definitions and events are linked to HTML nodes by data-nodename attributes within the template.