HEEx
HTML&コンポーネントフレンドリーに拡張されたEEx。
コンパイル時に構造上の問題がないかまでチェックできる。HTMLのspecに合っているかまではチェックしない。
sigil ~H
code:elixir
~H"""
<div class={@class} title="My div">
<SomeModule.some_func_compoent attr1="some string" attr2={@some_expression} {@other_dynamic_attrs}>
<.some_local_func_compoent attr1="some string">
</div>
"""
Introduce HTMLEngine + HEEx templates by msaraiva · Pull Request #1440 · phoenixframework/phoenix_live_viewで導入
Phoenix 1.6に入る予定
VS Codeの拡張はphoenixframework/vscode-phoenix
2021/8/16時点ではWIPとなっているけれども一応使うことができる
~Hや.heexのシンタックスハイライトは基本的に機能している
code:console
$ git clone https://github.com/phoenixframework/vscode-phoenix.git
$ cd vscode-phoenix
$ npm install
$ vsce package
$ code --install-extension phoenix-0.1.0.vsix
言語idはphoenix-heexなので
Emmetを使っている場合
code:setting.json
{
...
"emmet.includeLanguages": {
...
"phoenix-heex": "html"
},
...
}