0

I'm working on a ruby on rails app and i noticed that the HTML output isn't formatted, it's just flat. I'm using HAML and running Rails 4.0.0rc1, this also happened on 3.2.x and I am using Heroku and and Ruby 2.0.0. Here is a screen shot. I can't figure out why its happening. Does anyone know why this is happening?

enter image description here

1
  • If you want to see the HTML code in a nice way, you can always use extensions like firebug (or default web developer consoles) Commented May 6, 2013 at 2:45

1 Answer 1

3

Haml doesn't try to indent things nicely if Haml::Template.options[:ugly] is true. By default this is false in development, but true in production.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you for this, why would someone have a need for ugly HTML code tho? Why do they give us an option?
Because prettifying the html is slower
+1 @FrederickCheung. "Because prettifying the html is slower". It's slower three ways: It takes longer to generate, slowing down the Rails app. It takes longer to send to the user's browser, because those wasted leading whitespaces are worthless, and cost the server owner without any added value. Then it slows the user's session because the browser has to wait as the HTML is read and then throw away the wasted whitespace to get to the actual HTML tags. Don't even imagine that there is any value in formatted HTML in production. It's a major waste of everyone's time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.