Bogdan Cosmin
Bogdan Cosmin

Reputation: 187

clean html white space and new lines

How can i clean my html output of double whitespaces and new lines but not modifing the ones in textarea and pre tags using php?

Upvotes: 1

Views: 697

Answers (1)

Pascal MARTIN
Pascal MARTIN

Reputation: 401002

First of all, I would rather say : don't do this :

  • There is a risk that you'll introduce errors
  • This is not needed : your cleaned HTML will be rendered the same as the original one
  • You will not gain much on the page's size -- there are many other optimizations that should be done before trying to minify HTML.


Still, if you really want to do that, you are probably looking for an HTML Minifier.

There are several tools that exist, to do that ; here are a couple of exemples :

Upvotes: 3

Related Questions