ERB Beautify/Minify
Format or minify ERB (Embedded Ruby) templates. Beautify adds indentation for HTML structure; minify collapses whitespace.Overview
The ERB Beautify/Minify tool processes ERB templates as HTML:- Beautify — Indents HTML tags and ERB blocks with 2 spaces
- Minify — Removes comments, collapses whitespace, and strips spaces between tags
<% %>, <%= %>) are preserved and treated as content nodes.
Use Cases
Rails view cleanup
Format ERB templates from Rails projects for readability
Template optimization
Minify ERB templates for production to reduce view size
Code review
Standardize ERB indentation for diffs and version control
Legacy migration
Reformat old ERB templates with consistent indentation
Actions
- Beautify
- Minify
Indents HTML tags and ERB blocks with 2 spaces. ERB tags are treated as inline content.Input:Output:
Implementation Details
The ERB beautifier uses the same HTML beautification algorithm as the HTML Beautify tool. ERB tags (<% %>, <%= %>, <%# %>) are treated as text content.
Source: lib/tools/engine.ts:530-533
Key logic
The beautifier does not parse Ruby syntax inside ERB tags. Complex Ruby logic (multiline blocks, conditionals) may not indent perfectly.
ERB Tag Support
Output tags: <%= %>
Output tags: <%= %>
Logic tags: <% %>
Logic tags: <% %>
Comment tags: <%# %>
Comment tags: <%# %>
Keyboard Shortcuts
Cmd/Ctrl+Enter— Beautify (default)Cmd/Ctrl+Shift+C— Copy outputCmd/Ctrl+Shift+S— Download output
Related Tools
HTML Beautify/Minify
Format or minify HTML markup (same algorithm)
HTML Preview
Render HTML safely in an iframe