Welcome! » Log In » Create A New Profile

Mnify output

Posted by AJenbo 
Mnify output
May 22, 2013 06:43PM

It might be nice to minify the output. I have a rather simple implementation for minifying xHTML 1.0:

//Combine all white space
$html = preg_replace('/\s+/us', ' ', $html);
//Strip all white space surrounding block level elements
$html =  preg_replace(
//Strip all whitespace surounding line breaks
$html = preg_replace(&#039;/\s*<br \/>\s*/us&#039;, &#039;<br />&#039;, $html);

It's has a few backsides that i personally can live with

1: Does not respect literal (not written an an html entity) nbsp

2: Strips whitespace form "pre" content.

I think this should be rather fixable though

Edit: Line breaks, don't strip look-a-likes, less greedy regex

Re: Mnify output
May 22, 2013 06:47PM

Hmm, this wouldn't be too hard to add to the Generator.php class. I'm not going to implement it though.

Sorry, you do not have permission to post/reply in this forum.