Skip to main content

JavaScript Templating

https://medium.com/@BuildMySite1/javascript-templating-what-is-templating-7ff49d97db6b

JavaScript templating refers to the client side data binding method implemented with the JavaScript language.

Popular JavaScript templating libraries are AngularJS, Backbone.js, Ember.js, Handlebars.js, and Mustache.js.

Template Engine

The template engine is responsible for:

  • connecting to the data model;
  • processing the code specified in the source templates; and
  • directing the output to a specific pipeline, text file, or stream.

Benefits of using templateengines

  • encourages organization of source code into operationally-distinct layers (see e.g., MVC)
  • enhances productivity by reducing unnecessary reproduction of effort
  • enhances teamwork by allowing separation of work based on skill-set (e.g., artistic vs. technical)

Templating becomes useful when the information distributed may change, is too large to be maintained in various HTML pages by available human resources and not large enough to require heavier server-side templating.

Other Resources

https://medium.com/@daveford/80-of-my-coding-is-doing-this-or-why-templates-are-dead-b640fc149e22

Handlebars

Minimal templating on steroids

Semantic templates

Handlebars provides the power necessary to let you build semantic templates effectively with no frustration.

Mustache-compatible

Handlebars is largely compatible with Mustache templates. In most cases it is possible to swap out Mustache with Handlebars and continue using your current templates.

Fast execution

Handlebars compiles templates into JavaScript functions. This makes the template execution faster than most other template engines.

https://handlebarsjs.com/guide/#what-is-handlebars