A minimalistic HTML templating language for Elixir, inspired by Slim, that reduces verbosity in markup.
Slime is a minimalistic HTML templating language for Elixir, inspired by the Ruby Slim library. It allows developers to write HTML templates using a concise, indentation-based syntax that eliminates closing tags and reduces boilerplate. It seamlessly integrates Elixir code for dynamic content generation, making it ideal for web applications built with frameworks like Phoenix.
Elixir developers, particularly those using the Phoenix web framework, who want a cleaner, more expressive alternative to EEx templates for generating HTML.
Developers choose Slime for its significantly reduced verbosity compared to traditional HTML or EEx, its deep integration with Elixir's syntax and idioms, and its flexibility with embedded engines for JavaScript, CSS, or custom markup.
Minimalistic HTML templates for Elixir, inspired by Slim.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Eliminates closing tags and uses indentation, reducing boilerplate as shown in the slim-to-HTML conversion example where code is dramatically shorter.
Seamlessly embeds Elixir code with `=` and `-` operators, allowing natural use of conditionals and iteration like `if` and `for`, as demonstrated in the README examples.
Supports literals for classes (`.`) and IDs (`#`), making common HTML attributes quick to write without verbose syntax, shown in the attributes section.
Allows embedding of JavaScript, CSS, or custom engines via configurable settings, enabling extended functionality as detailed in the embedded engines section.
To locate exceptions, the `:keep_lines` config must be enabled, which alters output and requires recompilation, adding complexity to debugging workflows.
For use with Phoenix, a separate library (PhoenixSlime) is required, as noted in the README, introducing an extra dependency and setup step.
Conditionals use Elixir's `if` with `do`, differing from Ruby Slim's flow control, which can confuse developers familiar with the original, as explained in the differences section.