Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A lightweight but powerful templating engine, highly extensible, without DOM or jQuery dependency.
JavaScript HTML CSS
branch: master

Commit 64 (Post Beta)

BREAKING CHANGES

- debugMode is now false by default - which means
  that on error, an exception is thrown, rather than
  outputting an error message in the rendered output.
  To obtain previous behavior, set debugMode to true:
  $.views.settings.debugMode(true);

- The $.views.sub.cvt() no longer exists. Use tag.cvtArgs().

 NEW FEATURES

- AMD and CommonJs support for both JsRender and JsViews,
  providing both for NodeJS scenarios, and scenarios in which
  requireJS or similar AMD script loaders are used to load
  JsRender, JsObservable or JsViews.

- Support for JsRender in NodeJS:
  Support for Express and Hapi view engines using JsRender
  Support for loading templates from file, on Node, using
  the syntax: tmpl="@file.path"
  See: https://github.com/BorisMoore/jsrender-node-starter

- $.templates() now has an equivalent alternate name (alias):
  $.views.compile() which allows for immediate integration in some
  frameworks, such as Hapi templated views.
  See https://github.com/BorisMoore/jsrender-node-starter#hapi-templates-support

- Similarly, a compiled template now has an alternative shortcut API
  for the render method. The compiled template is it's own render
  function, so for a compiled template: var tmpl = $.templates(...);
  the following are equivalent:

  tmpl.render(data, helpers);
  tmpl(data, helpers);

- Support for allowCode has been simplified and improved. Docs to
  follow. You can now enable allowCode globally using
  $.views.settings.allowCode. A new tag: {{*: expression}} will
  return the evaluated expression - like {{: expression}} - but here
  the expression can allow any code.

- JsRender now has noConflict support, for loading a new instance of
  JsRender, without conflict with an already loaded instance.

- Tag property names can now include '.' and '_' characters:
  {{myTag _a=3 b.c=4 /}}

- Support simplified syntax when defining custom tags with just a markup
  string (template), or jsut a render method:
  $.views.tags("myTag", "this is the template");
  $.views.tags("a", function(...){
     //this is the render function
  });

- The debug helpers: {{dbg:}} {{dbg ...}} {{~dbg()}} now throw and catch,
  rather than including a debugger; statement. To use this feature set
  your browser/debugger to stop on caught exceptions.
  (See also #239)

- A lot of changes have been made to considerably optimize performance
  when using JsRender to render simple templatesPerf. Optimized template
  will not need to instantiate view objects, and hence will be faster.
  A compiled template has a tmpl.useViews property which shows whether
  it allowed that optimization. (tmpl.useViews false)

Bug Fixes:

- #239:

- #252
  (Improved syntax error message e.g.:
  '{{include}} block has {{/for}} with no open {{for}}'
latest commit 913fadd580
@BorisMoore authored

README.md

JsRender: best-of-breed templating

Simple and intuitive, powerful and extensible, lightning fast

JsRender is a light-weight but powerful templating engine, highly extensible, and optimized for high-performance pure string-based rendering, without DOM or jQuery dependency.

JSRender and JsViews together provide the next-generation implementation of both JQuery Templates, and JQuery Data Link - and supersede those libraries.

Documentation and Downloads

Documentation, downloads, samples and API docs and tutorials are available on the www.jsviews.com website.
(Stay tuned at www.jsviews.com for additional content - coming incrementally as we move towards V1.0)

JsRender and JsViews

JsRender is used for rendering of templates to strings, ready for insertion in the DOM.
It is also used by the JsViews platform, which adds data binding to JsRender templates, and provides a fully-fledged MVVM platform for easily creating interactive data-driven single page apps and websites.

Demos

In addition to the demos at www.jsviews.com/#samples, and throughout the API documentation, see also:

  • the demos folder of this GitHub repository - available here as live samples.
  • the demos folder of the JsViews GitHub repository - or here as live samples.

Current Status

JsRender is now a beta release, currently moving towards V1.0.

Something went wrong with that request. Please try again.