Creating HTML Templates with Slim
Learn to use Slim to create HTML templates.
We'll cover the following...
We'll cover the following...
Slim template
Slim is a templating language that can replace ERB. It’s designed to require much less code to achieve the same results, and it does this by using a nested structure instead of HTML tags. Consider this ERB:
In Slim, this would look like so:
Slim treats each line as an opening HTML tag, and anything indented under that line will be rendered inside that tag. Helper methods and instance variables can be accessed using =, like so:
To execute logic such as looping ...