Herb Formatter
Package: @herb-tools/formatter
[!WARNING] Experimental Preview
This formatter is currently in experimental preview. While it works for many common cases, it may potentially corrupt files in edge cases. Only use on files that can be restored via git or other version control systems.
Auto-formatter for HTML+ERB templates with intelligent indentation, line wrapping, and ERB-aware pretty-printing.
Perfect for format-on-save in editors and formatting verification in CI/CD pipelines. Transforms templates into consistently formatted, readable code while preserving all functionality.
Installation
:::code-group
npm add @herb-tools/formatter
pnpm add @herb-tools/formatter
yarn add @herb-tools/formatter
bun add @herb-tools/formatter
:::
Usage
Format a file
herb-format templates/index.html.erb
herb-format /full/path/to/template.html.erb
Format from stdin
cat template.html.erb | herb-format
herb-format - < template.html.erb