0

When using PHP in a simple HTML page like:

<html>
    <head>
    </head>
    <body>
    </body>
</html>

I could use ob_start() and ob_end_flush() and then str_replace the \n to do something like:

<html><head></head><body></body></html>

saving the document size in order to make the webpage load faster.

I was just wondering if that is possible in the Ruby on Rails?

jk jk
  • 1,027
  • 2
  • 13
  • 28
  • Don't bother too much on stripping white space, but use gzip compression first and see if you gain some better loading speed then. – feeela May 03 '13 at 18:22
  • when the webpage is large this is an useful method to make page load faster and smaller,you can view google homepage source – jk jk May 03 '13 at 18:23
  • So, why don't you minify it before sending something to the client (which is suppressed by `ob_*` functions). Just do a string- or regex-replace on the output before it is send. Anyway this is not a PHP, but a Ruby question. – feeela May 03 '13 at 18:36
  • the processing overhead of removing the newlines will probably vastly exceed any bandwidth savings you might achieve. – Marc B May 03 '13 at 19:05

0 Answers0