Slim Line breaks and formatting
From the docs:
Slim::Engine.set_default_options pretty: true
or directly
Slim::Engine.default_options[:pretty] = true
To expand a bit, as @rubiii mentioned in the comments this is a feature of Slim. For the same reasons it's good practice to minify and compress Javascript and CSS in production Slim strips unecessary whitespace from the HTML it produces without this :pretty
option set to true
.
If you have some config/initializers/slim.rb
file you can configure the :pretty
option dynamically by checking the environment.
Slim::Engine.set_default_options pretty: Rails.env.development?
Otherwise you should set this option to true
only in config/environments/development.rb
, leaving it false
in production.