I want 'view source' in the browser to show the kind of HTML that would be created by running slimrb
from the command line with the -p
option.
You can configure Slim to always pretty print your HTML output using the :pretty
option, which defaults to false
. Using Rails, the easiest place to set this would likely be in an environment file.
From the docs, they show this example adding this code to config/environments/development.rb
:
# Indent html for pretty debugging and do not sort attributes
Slim::Engine.set_options pretty: true, sort_attrs: false
Note that using this option is slower (per the documentation), so you'll probably only want to do this in your development environment, as in the example.