Skip to content

v0.6.0

Choose a tag to compare

@tyler-johnson tyler-johnson released this 07 Oct 00:37
· 187 commits to master since this release

This version is significantly different from the previous version of Temple. Below is a list of the most important changes:

  • Templates are now compiled directly to JavaScript from the templates. Prior, templates built a simple JSON tree, however this has been retired for an AST based compile with decent source map support. This has nice bonuses, including embedded JavaScript and ahead-of-time optimization.
  • DOM rendering is handled by incremental-dom. While re-renders are no longer as efficient, the DOM is thrashed much less. Rendering is now significantly more performant.
  • Views are now global. In the previous version, a template became a view. Now, a template contains one or more views and those views are loaded into a global namespace. To access a view after rendering it, use Temple.create().
  • Views have a singleton element they are rendered into. Prior, views were very dynamic, containing any number of children nodes that rendered in place. Now, to work with incremental-dom, views declare a custom element that is created with the view.
  • Views and partials are now seperate. Views represent complex content, including data, where as partials are only subsets of templates. Partials, unlike views, cannot be rendered on their own and must be rendered inside of a view. For clarification, here is the difference in syntax:
    View syntax: <my-view></my-view>
    Partial syntax: {{> my-partial }}
  • Data proxies are global and cannot be declared on individial views.
  • Temple.Model is now Temple.Context.
  • In Mustache, when a template gets a function, that function is executed and its result is used in the template. In previous versions of Temple, the context the function was run in was the underlying model. Now, to be more conformant with Mustache, the context of the function is the raw value of the underlying Temple.Context.