There should be a way to remove redundant spaces and line breaks. See also [this article](http://perfectionkills.com/experimenting-with-html-minifier/) and [htmlcompressor](https://github.com/serg472/htmlcompressor/blob/master/src/main/java/com/googlecode/htmlcompressor/compressor/HtmlCompressor.java#L64).