Slim is an [[MIT License]] licensed markup language that transpiles to [[HTML]] written in [[Ruby]]. - [Website](https://slim-template.github.io/) - [Source](https://github.com/slim-template/slim) - Documentation > Slim is a template language whose goal is to reduce the view syntax to the essential parts without becoming cryptic. It started as an exercise to see how much could be removed from a standard html template \- official readme # Notability It has been my preferred templating language for Ruby for an extremely long time. If one must use HTML, this is the best way to avoid doing so directly. # Philosophy # Platform Support ## Implementations The native and most maintained version is written in [[Ruby]]. There are very similar parsers/converts for other development environments: ### Crystal - [Slang](https://github.com/jeromegn/slang) for [[Crystal]] ### Go It seems like most people ended up caving and just use [[Go]]'s weird built-in templating system. - https://github.com/mattn/go-slim - https://github.com/stackus/goht - supports Slim, [[Haml]], and "EGo" (ERb-style) templates - https://github.com/Joker/jade (last updated [[2023]]) - https://github.com/eknkc/pug (last updated [[2018]]) - https://github.com/knaka/pug (fork, with fixes, last updated [[2022]]) - https://github.com/yosssi/ace (last updated [[2018]]) - https://github.com/nissy/ace (fork, with minor tweaks, last updated [[2019]]) - https://github.com/eknkc/amber (last updated [[2017]]) - https://github.com/honux/amber (fork, with aditional features, archived [[2018]]) ### Python - [Plim](https://github.com/avanov/Plim) for [[Python]] (last updated [[2022]]) ### Javascript - [Pug](https://github.com/pugjs/pug) for Javascript (different but well loved) - [Pugneum](https://github.com/matheusmoreira/pugneum) for Javascript (fork of Pug, turned to [[Generative AI|Slop]]) - [Emblem.js](https://github.com/machty/emblem.js) for [[Javascript]] (related to [[Handlebars]], last updated [[2019]]) # Features # Example ```slim doctype html html head title Slim Examples meta name="keywords" content="template language" meta name="author" content=author link rel="icon" type="image/png" href=file_path("favicon.png") javascript: alert('Slim supports embedded javascript!') body h1 Markup examples #content p This example shows you how a basic Slim file looks. == yield - if items.any? table#items - for item in items tr td.name = item.name td.price = item.price - else p No items found. Please add some inventory. Thank you! div id="footer" == render 'footer' | Copyright © #{@year} #{@author} ``` # Tips # References