JetBrains Rider 2018.1 Help

Handlebars and Mustache

JetBrains Rider recognizes and provides support for Handlebars expressions and Mustache templates in dedicated Handlebars and Mustache files that have the extension .hbs or .mustache respectively. JetBrains Rider distinguishes these file types and processes their contents according to default or custom settings specified on the Templates page of the Settings/Preferences dialog.

Before you start, install and activate the Handlebars/Mustache repository plugin. The plugin is not bundled with JetBrains Rider, but it can be installed from the JetBrains plugin repository as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.

Configuring coding assistance for Handlebars expressions and Mustache templates

  1. Open the Templates page (File | Settings | Languages and Frameworks | JavaScript | Templates for Windows and Linux or JetBrains Rider | Preferences | Languages and Frameworks | JavaScript | Templates for macOS). Switch to the Handlebars/Mustache area.
  2. Enable or disable tag completion.
    • To have JetBrains Rider automatically insert the second closing curly brace (}) of a Handlebars expression as soon as you type the first closing one, select the Automatically insert closing tag checkbox.

      JetBrains Rider also recognizes triple stashes ({{{) that prevent escaping values inside expressions. In this case, JetBrains Rider automatically inserts two closing curly braces as soon as you type the first closing one.

    • When this check box is cleared, you have to type the closing curly braces and triple stashes manually.
  3. To have Handlebars expressions and Mustache templates automatically reformatted during code generation, refactoring, or reformatting (Ctrl+Alt+Enter), select the Enable formatting checkbox.

    If the checkbox is cleared, the original formatting of Handlebars expressions and Mustache templates is preserved.

  4. From the Language for comments drop-down list, select the language to inherit the style for comments from. When you enter a line or block comment by pressing Ctrl+Alt+/ or Ctrl+Shift+/, JetBrains Rider inserts the comment delimiters that are used in the chosen language, for example, {{!----}} for Handlebars, /**/ for JavaScript, <!----> for HTML, etc.
Last modified: 20 August 2018

See Also