.html files) use Prettier with @aero-js/prettier-plugin-aero. JavaScript and TypeScript in your project can keep using oxfmt — the two tools coexist via per-language VS Code defaults.
Quick setup
- Install dev dependencies:
- Add
.prettierrc.json:
-
Install the Prettier VS Code extension. The Aero extension recommends it; configure Prettier for
.htmlfiles via project.prettierrc(and optional editor defaults for[html]if you want workspace-wide formatting). -
(Optional) Exclude Aero HTML from oxfmt so templates are not double-formatted. In
.oxfmtrc.json:
Standard Prettier options
All usual Prettier settings (printWidth, useTabs, htmlWhitespaceSensitivity, singleAttributePerLine, etc.) apply to Aero .html files. Embedded <script is:build lang="ts"> and <style> blocks are formatted with Prettier’s JS/TS/CSS rules.
The plugin adds three Aero-only options (also set in .prettierrc.json or under overrides). With the Aero VS Code extension installed, those options get autocomplete and hover docs in Prettier config files.
What aeroAttributePrefix rewrites
Prettier rewrites Aero framework attribute names that are not native HTML. It leaves real HTML alone (including when Aero binds it), third-party attrs (x-*, hx-*, …), emit-only markers (data-aero-event, data-aero-bind, …), and unimplemented names (computed:*, state).
Rewritten families: build directives (if, for, props, …), key, simple runtime (show, html, busy, text), on:*, class:*, bind:*, and script taxonomy (is:build, is:state, is:inline, is:blocking).
Plain HTML attributes (e.g.
<label for="email">, disabled="{ saving }") are never rewritten. Author text="{ … }" and data-aero-text="{ … }" are the same directive under different modes — not an emit-only marker.
Example with Aero options:
CLI
Format templates from the project root:@aero-js/create include .prettierrc.json and recommended VS Code extensions.