diff --git a/lib/Minify/HTML.php b/lib/Minify/HTML.php index f6ba63d..5089833 100644 --- a/lib/Minify/HTML.php +++ b/lib/Minify/HTML.php @@ -77,9 +77,6 @@ class Minify_HTML { .'|ol|opt(?:group|ion)|p|param|t(?:able|body|head|d|h||r|foot|itle)' .'|ul)\\b[^>]*>)/i', '$1', $html); - // line break within some tags to limit line lengths - $html = preg_replace('/(<(?:div|span|a|p|input)) ([^>]+>)/i', "$1\n$2", $html); - // remove ws outside of all elements $html = preg_replace_callback( '/>([^<]+)' @@ -90,7 +87,10 @@ class Minify_HTML { self::_fillPlaceholders($html, self::$_pres, 'PRE'); self::_fillPlaceholders($html, self::$_tas, 'TEXTAREA'); self::_fillPlaceholders($html, self::$_scripts, 'SCRIPT'); - self::_fillPlaceholders($html, self::$_styles, 'STYLE'); + self::_fillPlaceholders($html, self::$_styles, 'STYLE'); + + // use newlines before 1st attribute in open tags (to limit line lengths) + $html = preg_replace('/(<[a-z\\-]+)\\s+([^>]+>)/i', "$1\n$2", $html); self::$_cssMinifier = self::$_jsMinifier = null; return $html; diff --git a/web/test/_test_files/html/before.min.html b/web/test/_test_files/html/before.min.html index 4935cd8..d8862c2 100644 --- a/web/test/_test_files/html/before.min.html +++ b/web/test/_test_files/html/before.min.html @@ -1,9 +1,21 @@ -
+id="pageHeader">css Zen Garden
The Beauty of CSS Design
White space is important here!
A demonstration of what can be accomplished visually through CSS-based design. Select any style sheet from the list to load it into this page.
A demonstration of what can be accomplished visually through CSS-based design. Select any style sheet from the list to load it into this page.