codemix / htmling

Polymer / HTML5 templating syntax for node.js
MIT License
177 stars 32 forks source link

Better compiler #2

Closed phpnode closed 10 years ago

phpnode commented 10 years ago

This PR makes quite a few disjointed changes:

  1. <layout> is now <include> and supports bind="{{something}}", repeat="{{thing in things}}". This makes it possible to use it for both "layouts" and "partials".
  2. Instead of the compiler basically being a huge AST in which we fill in the blanks, the compiler now uses a parse + replace approach. We write the compilation cases in normal JS, parse those to AST, perform transformations on it and include them in the real AST.
  3. There is now an optimiser which does several passes to remove unnecessary code, hoists functions etc.
  4. There is now explicit support for use as an express view engine.