Slim compiles concise, indentation-driven templates to HTML for Rails, Sinatra, and other Ruby frameworks with optional logic-less and I18n plugins.
Overview
Slim is a Ruby template language that reduces markup verbosity by relying on indentation instead of closing tags, while remaining configurable for HTML-style closers and shortcut syntax. It emphasizes automatic HTML escaping, performance comparable to ERB, and integration with Rails 5+ and Sinatra through Tilt.
Temple powers parsing and compilation, enabling plugins such as logic-less modes akin to Mustache, translation helpers, and embedded Markdown or Textile engines. Teams can mix Slim templates into existing apps by adding the gem and using .slim view files.
The syntax balances readability with speed benchmarks documented in the project, and Unicode is supported throughout tags and attributes. Logic-less and translator plugins extend the core for content-focused templates.
It fits Ruby projects seeking maintainable views with less punctuation than traditional ERB or Haml-heavy files.
Key features
- Indentation-based syntax
- Automatic HTML escaping
- Rails and Sinatra integration
- Temple parsing pipeline
- Logic-less plugin mode
- Embedded Markdown support
- Configurable shortcut tags
- Streaming Rails support
Use cases
- Rails view templates
- Sinatra HTML pages
- Logic-less content rendering
- Translated template plugins