Herb: Powerful and seamless HTML-aware ERB parsing and tooling

herb-tools.dev

119 points by todsacerdoti 3 days ago


jy14898 - 3 days ago

ERB: https://en.wikipedia.org/wiki/ERuby

Alifatisk - 3 days ago

> Parses input fast enough to update on every keystroke, ensuring real-time responsiveness…

Wow!!! Cool to see ERB being embraced and enhanced in this way, I’ll have to check it out

notpushkin - 3 days ago

If it is what I think it is, it’s extremely neat. Parsing both HTML and templating syntax at the same time is way more robust than doing just the templating and hoping for the best.

I was thinking about something like this, but with some blend of Jinja2 / Twig / Nunjucks [1] syntax and Svelte/JSX-like use of variables in element attributes:

  {% for para in page.body %}
    <p class={{ para.class }} {{ **para.attrs }}>
      {{ para.text }}
    </p>
  {% endfor %}
---

[1]: the irony is not lost on me that I’m mentioning Python, PHP and JS template engines in a Ruby discussion :-) Liquid is the closest equivalent I think, but there was some crucial piece missing last time I had to use it, though I can’t remember what exactly.

mrinterweb - 3 days ago

One thing that's not very clear from the documentation is what the application of this may be. I see that it parses ERB and or HTML into an AST. Is this intended to enable improved HTML and ERB linters and language servers? This seems like a tool that other development tools will benefit from.

I realize this is new, but as tools start using herb, it would nice to link to those tools from the herb website and or github readme.

9dev - 3 days ago

If you're not familiar with the Ruby ecosystem, the site does a very poor job of communicating what this is actually about. A single definition of ERB would have helped a lot.

Mystery-Machine - 3 days ago

It's great to see new developer tooling advances in Ruby ecosystem! Looking forward to the VS Code integration as well as linter integrations.

evtothedev - 3 days ago

I hope this results in a vastly improved version of the VSCode extension vscode-erb-beautify.

ksec - 3 days ago

Now I am idling waiting if this will be picked up by Rails Team. Making it first choice default.

banga - 3 days ago

Excellent, I was looking for a Educational Records Bureau parser.

Oh, wait...

returntooffice - 3 days ago

[dead]