A Prettier plugin that formats .html.eex and .html.leex files used in Elixir/Phoenix projects. Current stable version is 0.6.0. This plugin leverages Prettier's parsing and formatting capabilities to handle Elixir's EEx templates, preserving embedded Elixir expressions while formatting the surrounding HTML. It requires a minimum of Elixir 1.10 and Erlang OTP 22. Key differentiators include support for LiveView .leex files, configurable multiline expression formatting, and seamless integration with Phoenix projects via mix aliases. The plugin is actively maintained with regular bug fixes and breaking changes between major versions.
npm install prettier-plugin-eexVerified import paths — ran on the pinned version, not inferred.
Installation and basic usage of prettier-plugin-eex: setting up .prettierrc, formatting EEx files via CLI and programmatic API.
Update your Elixir to >=1.10 and Erlang OTP to >=22.
If you have a custom Prettier integration that relies on the embed method, update your code to work with the 'print' method.
Update CI scripts to expect non-zero exit on formatting errors.
Set 'prettierPath' in VS Code settings to './assets/node_modules/prettier' or use explicit plugins array in .prettierrc with absolute/relative path.
Keep an eye on releases and update prettier as needed.
Install the plugin: yarn add -D prettier prettier-plugin-eex. Ensure you are running prettier from the directory containing node_modules.
Add an override in .prettierrc for *.html.eex files with parser: 'html-eex'.
Check your Elixir version (>=1.10) and ensure the EEx templates are syntactically valid.
Verify the file has .html.eex or .html.leex extension and your .prettierrc overrides match that pattern.