Skip to content
Herb Logo

Herb

What is Herb?

Herb is a powerful and seamless HTML-aware ERB toolchain and an ecosystem of developer tools built specifically for HTML+ERB (.html.erb) files. It is designed to simplify and enhance the experience of working with HTML+ERB templates through precise, accurate tooling.

Parser

At the core of the Herb ecosystem is the Herb Parser, a fast, portable, and HTML-aware ERB parser written in C. The parser generates a detailed, accurate syntax tree that serves as the foundation for reliable code analysis, transformations, and developer tooling.

Toolchain

The Herb toolchain includes developer tools (CLI, language server, formatter, linter, browser dev tools), language bindings (for Ruby, Node.js, Java, Rust, and the Browser using WebAssembly), and utility libraries (language service, highlighter, minifier, printer).

All these components leverage the Herb Parser's syntax tree to provide consistent, accurate, and helpful tooling experiences.

Engine

Herb::Engine is a new, HTML-aware ERB rendering engine built on the Herb Parser. It is designed to be API-compatible with Erubi::Engine while adding structural awareness of HTML+ERB content, enabling features like HTML validation, security checks, and precise error reporting.

The Engine powers ReActionView and lays the foundation for a modern view layer for Rails and other Ruby web frameworks.

ReActionView
🌱 A new ActionView-compatible ERB engine with modern DX, re-imagined with Herb::Engine.
GitHub · Website · Documentation

Ecosystem

The Herb ecosystem offers multiple tools that integrate seamlessly into editors, developer environments, and CI pipelines:

ToolDescription
Herb ParserFast, portable, HTML-aware ERB parser written in C.
Herb LinterStatic analysis to enforce best practices and identify common mistakes.
Herb FormatterAutomatic, consistent formatting for HTML+ERB files. (experimental)
Herb Language ServerRich editor integration for VS Code, Zed, Neovim, and more.
Herb EngineHTML-aware ERB rendering engine, API-compatible with Erubi.
Herb Dev ToolsIn-browser dev tools for inspecting and debugging templates, shipped with ReActionView.
ReActionViewActionView-compatible ERB engine with modern DX for Rails.

You can use the Herb Parser programmatically in Ruby, Java, Rust, as well as in JavaScript via Node.js, WebAssembly, or directly in browsers.

For a complete overview of all available tools, libraries, and integrations, visit the Projects page on our documentation site.

Motivation

HTML+ERB templates never really had good, accurate, and reliable tooling. While developer tooling for Ruby code improved significantly in the last few years (especially with the introduction of the new Prism parser), HTML+ERB files remained underserved, lacking fundamental support like syntax checking, auto-formatting, linting, and structural understanding.

At the same time, with the rise of tools like Hotwire, Stimulus, Turbo, HTMX, Unpoly, and Alpine.js, advanced HTML templating became increasingly relevant (again). Developers expect modern, reliable, and precise tooling, especially given the robust ecosystem available to JavaScript frameworks and libraries.

Herb was built to close this tooling gap with an HTML-aware approach, understanding both HTML structure and ERB as first-class citizens, to provide the kind of tooling modern developers expect in the age of language servers, LLMs, and AI-driven workflows.

Command-Line Usage

Install the Herb gem via RubyGems:

sh
gem install herb

For detailed information, like how you can use Herb programmatically in Ruby and JavaScript, visit the documentation site.

Basic usage to analyze all HTML+ERB files in your project:

sh
herb analyze .

This will give you an overview of how the Herb Parser sees your project:

--- SUMMARY --------------------------------------------------------------------
Total files: 145
✅ Successful: 143 (98.6%)
❌ Failed: 0 (0.0%)
⚠️ Parse errors: 2 (1.4%)
⏱️ Timed out: 0 (0.0%)

Files with parse errors:
  - app/views/contributions/index.html.erb
  - index.html.erb

Results saved to 2025-06-29_12-16-23_erb_parsing_result_rubyevents.log

Lint your HTML+ERB templates:

sh
npx @herb-tools/linter

Format your HTML+ERB templates:

sh
npx @herb-tools/formatter

Background and Talks

The Herb Parser was first introduced at RubyKaigi 2025 in April 2025 with the talk Empowering Developers with HTML-Aware ERB Tooling.

At RailsConf 2025 in July 2025, the Herb ecosystem was expanded with the talk The Modern View Layer Rails Deserves: A Vision for 2025 and Beyond, introducing the linter, formatter, language server, and the vision for ReActionView.

At Rails World 2025 in September 2025, Herb::Engine, ReActionView, and the visual dev tools were launched with the talk Introducing ReActionView: An ActionView-Compatible ERB Engine.

At San Francisco Ruby Conference 2025 in November 2025, the keynote Herb to ReActionView: A New Foundation for the View Layer gave an overview of how Herb came to be, what Herb can do for you today, and how it could enable the next generation of the Rails view layer with ReActionView.

Contributing

Bug reports and pull requests are welcome on GitHub. Please see the CONTRIBUTING.md document for guidelines on how to set up Herb for local development and how to contribute to Herb.

Prior Art & Inspiration

While Herb brings a fresh approach to HTML+ERB tooling, it builds upon and learns from several existing tools and approaches in the ecosystem:

Herb differentiates itself by being HTML-aware from the ground up, providing a unified parsing approach that understands both HTML and ERB as first-class citizens, rather than treating one as embedded within the other.

License

This project is available as open source under the terms of the MIT License.

Released under the MIT License.