SuperSlim
A from-scratch Slim engine for Rails: no Temple, a single-pass compiler, and a formatter and a linter that read templates with the same parser.
gem "super-slim"
In numbers
Loading the latest numbers…
Same HTML
SuperSlim renders what Slim 5 renders with format: :html, sort_attrs: false, down to the byte. Here is the benchmark page, rendered by both engines:
……Identical on 295 of Slim’s own tests, on the 1,400 templates of a production app, and on 10,000 new random templates at every CI run.
In the box
An engine for Rails
A railtie registers .slim with Action View, and SuperSlim.compile serves plain Ruby. Every - and = stays on its template line, so backtraces point at the right one.
A formatter that cannot change a page
super-slim format writes one layout, and compiles both versions before writing: if the Ruby differs, it refuses.
A linter with HTML and accessibility rules
Rules from slim-lint, haml-lint, erb_lint, Herb and jsx-a11y, each with a flagged and a clean example. The Ruby inside goes to RuboCop, through a plugin.
Tailwind class names
One option, and .rounded-b-[3px], .size-2.5 or .lg:hover:underline work as class shortcuts. Attribute lists keep their meaning.
Nothing new to learn
The whole Slim 5 grammar, the same HTML, the same errors. What SuperSlim leaves out fails at compile time instead of rendering wrong. The grammar is Slim’s, by the Slim Team.
Quick start
Gemfile
gem "super-slim" # instead of slim-rails
Terminal
bundle exec super-slim format # once
bundle exec super-slim lint # in CI
bundle exec super-slim format --check # in CI