Handlebars and Mustache
Available only in PyCharm Professional: download to try or compare editions
Required plugins:
JavaScript and TypeScript
, Handlebars/Mustache
- The plugins are available only in PyCharm Professional, where they are enabled by default.
With PyCharm, you can use Handlebars expressions and Mustache templates in hbs or mustache files. PyCharm processes contents of such files according to default or custom settings specified on the Templates page of the Settings dialog.
Make sure the JavaScript and TypeScript plugin is enabled in the settings. Press CtrlAlt0S to open settings and then select Plugins. Click the Installed tab. In the search field, type JavaScript and TypeScript. For more information about plugins, refer to Managing plugins.
Install and enable the Handlebars/Mustache plugin on the Settings | Plugins page, tab Marketplace, as described in Installing plugins from JetBrains Marketplace.
In the Settings dialog (CtrlAlt0S) , go to Languages & Frameworks | JavaScript | Templates.
On the Templates page that opens, switch to the Handlebars/Mustache area.
To automatically insert the second closing curly brace
}
of a Handlebars expression on typing the first closing one, select the Automatically insert closing tag checkbox.PyCharm also recognizes triple stashes
{{{
that prevent escaping values inside expressions. In this case, PyCharm automatically inserts two closing curly braces as soon as you type the first closing one.To automatically reformat Handlebars expressions and Mustache templates on code generation, refactoring, or pressing CtrlAlt0L, select the Enable formatting checkbox. Otherwise, PyCharm always keeps their original formatting.
Choose the language to use the style for comments from. When you enter a line or block comment by pressing Ctrl0/ or CtrlShift0/, PyCharm inserts the comment delimiters that are used in the chosen language, for example:
{{!----}}
for Handlebars/**/
for JavaScript<!---->
for HTML
To configure Handlebars/Mustache-aware syntax highlighting, in the Settings dialog (CtrlAlt0S) , go to Editor | Color Scheme | Handlebars/Mustache. Select the color scheme, accept the highlighting settings inherited from defaults or customize them as described in Configuring Colors and Fonts.
Thanks for your feedback!