Luitjes IT | erb2builder

14-Apr-2022 1155
As we were building a new kind of ruby-based no-code platform, we ran into a problem. There is great tooling for parsing Ruby code, and there is great tooling for parsing HTML code. But when you deal with HTML ERB templates, you end up mostly ignoring either the Ruby or the HTML.This is why editors, linters, and tools like Rubocop generally don’t do quite as well on HTML ERB templates.We ended up combining Nokogumbo, Treetop, and the parser gem, to build a custom HTML ERB parser. This parser generates an abstract syntax tree that retains both the HTML structure and the Ruby structure.Pretty cool, but of course there is zero tooling for our weird custom abstract syntax tree format.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle