Skip to content

Handlebars

Taritsyn edited this page May 29, 2024 · 13 revisions

BundleTransformer.Handlebars contains one translator-adapter - HandlebarsTranslator (supports the Handlebars version 4.7.8). This adapter makes translation of Handlebars templates to JS code. Also contains the HandlebarsAssetHandler debugging HTTP handler, which is responsible for text output of translated Handlebars asset.

Files whose names start with an underscore are compiled as the globally defined partials (first underscore are removed from the template name).

As a JS engine is used the JavaScript Engine Switcher library. For correct working of this module, you need to install one of the following NuGet packages:

After package is installed and JS engine is registered, need set a name of JS engine (for example, MsieJsEngine) to the name attribute of /configuration/bundleTransformer/handlebars/jsEngine configuration element in the Web.config file.

To use a debugging HTTP handlers in the IIS Classic mode (this also applies to the XSP web server for Mono), you need add to the /configuration/system.web/httpHandlers element of the Web.config file a following code:

<add path="*.handlebars" verb="GET"
  type="BundleTransformer.Handlebars.HttpHandlers.HandlebarsAssetHandler, BundleTransformer.Handlebars" />
<add path="*.hbs" verb="GET"
  type="BundleTransformer.Handlebars.HttpHandlers.HandlebarsAssetHandler, BundleTransformer.Handlebars" />