Handlebars and Mustache
WebStorm recognizes and provides support for Handlebars expressions and Mustache templates in dedicated Handlebars and Mustache files that have the extension .hbs
or .mustache
respectively. WebStorm distinguishes these file types and processes their contents according to default or custom settings specified on the Templates page of the Settings/Preferences dialog.
Configuring coding assistance for Handlebars expressions and Mustache templates
- Open the Templates page ( for Windows and Linux or for macOS). Switch to the Handlebars/Mustache area.
- Enable or disable tag completion.
- To have WebStorm 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 check box.WebStorm also recognizes triple stashes (
{{{
) that prevent escaping values inside expressions. In this case, WebStorm 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.
- To have WebStorm automatically insert the second closing curly brace (
- To have Handlebars expressions and Mustache templates automatically reformatted during code generation, refactoring, or reformatting (Ctrl+Alt+L), select the Enable formatting check box.
If the check box is cleared, the original formatting of Handlebars expressions and Mustache templates is preserved.
- 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+Slash or Ctrl+Shift+Slash, WebStorm inserts the comment delimiters that are used in the chosen language, for example,
{{!----}}
for Handlebars,/**/
for JavaScript,<!---->
for HTML, etc.