WebApps with LocalStorage and AppCache/Create an AppLSAC/Handlebars4Code

Introduction
is a library and NPM module that extends Handlebars with Helpers for Code Generation in a specific programming language (e.g. Javascript)

Learning Tasks

 * Explore the Demo for Handlebars4Code or the Hello World example with the source code to explore the basic workflow for Javascript template engines.

Use Cases - Javascript Template Engines
The following use-cases guide you from standard  usage toward   usage.

Basic Use Case
Assume you have a JSON with data in it and you want to create a HTML table with data in the JSON.

The HTML output:

For this basic examples you might want to use just Handlebars directly as Javascript template.

Use Case - Generation of Programming Code
For generation of Programming code the standard markers with two brackets  are replaced in general by markers with 3 brackets   because the replacement by Handlebars with two brackets escapes characters like “&gt;” by. This is for HTML output in general useful, but for generation of code with template engine the code may become syntactically incorrect due to escaping of characters

The Code Template for  would e.g. like this:

The replacement of  would provide the correct desired output

and the replacement of  would create an syntactical error of the generated code by

.

If you want to use  for code generation use 3 brackets for encoding the variable replacement with JSON content. The same is applicable, if you create HTML-tags with