mirror of
https://github.com/mrclay/minify.git
synced 2025-08-08 23:26:43 +02:00
Minfy_HTML: all Unix newlines, replaces spaces with newlines in some tags to limit line lengths
Minify_CSS: fix Issue 49, uses newlines in common descendant selectors to limit line lengths All tests passing with shorter lines and no added bytes!
This commit is contained in:
@@ -34,7 +34,7 @@ class Minify_HTML {
|
||||
self::$_jsMinifier = $options['jsMinifier'];
|
||||
}
|
||||
|
||||
$html = trim($html);
|
||||
$html = str_replace("\r\n", "\n", trim($html));
|
||||
|
||||
self::$_isXhtml = (false !== strpos($html, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML'));
|
||||
|
||||
@@ -77,6 +77,9 @@ 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(
|
||||
'/>([^<]+)</'
|
||||
|
Reference in New Issue
Block a user