mirror of
https://github.com/mrclay/minify.git
synced 2025-08-11 00:24:11 +02:00
Minify/HTML.php : + 'xhtml' option
builder : fixed Issue 52
This commit is contained in:
@@ -11,7 +11,7 @@ var MUB = {
|
||||
,success : function (data) {
|
||||
if (data === '1') {
|
||||
MUB._minRoot = '/min/';
|
||||
$('#minRoot').html('/min/');
|
||||
$('span.minRoot').html('/min/');
|
||||
} else
|
||||
fail();
|
||||
}
|
||||
|
@@ -70,7 +70,7 @@ with cache headers.</p>
|
||||
|
||||
<h2>How to serve these files as a group</h2>
|
||||
<p>For the best performance you can serve these files as a pre-defined group with a URI
|
||||
like: <code>/min/?g=keyName</code></p>
|
||||
like: <code><span class=minRoot>/min/?</span>g=keyName</code></p>
|
||||
<p>To do this, add a line like this to /min/groupsConfig.php:</p>
|
||||
|
||||
<pre><code>return array(
|
||||
@@ -96,7 +96,7 @@ remove them. Therefore, you will want to remove those that point to files alread
|
||||
in your list, and move any others to the top of the first file in your list
|
||||
(imports below any styles will be ignored by browsers as invalid).</p>
|
||||
<p>If you desire, you can use Minify URIs in imports and they will not be touched
|
||||
by Minify. E.g. <code>@import "<span id=minRoot>/min/?</span>g=css2";</code></p>
|
||||
by Minify. E.g. <code>@import "<span class=minRoot>/min/?</span>g=css2";</code></p>
|
||||
|
||||
</div><!-- #app -->
|
||||
|
||||
|
@@ -22,7 +22,18 @@ class Minify_HTML {
|
||||
* "Minify" an HTML page
|
||||
*
|
||||
* @param string $html
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* 'cssMinifier' : (optional) callback function to process content of STYLE
|
||||
* elements.
|
||||
*
|
||||
* 'jsMinifier' : (optional) callback function to process content of SCRIPT
|
||||
* elements. Note: the type attribute is ignored.
|
||||
*
|
||||
* 'xhtml' : (optional boolean) should content be treated as XHTML1.0? If
|
||||
* unset, minify will sniff for an XHTML doctype.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function minify($html, $options = array()) {
|
||||
@@ -36,7 +47,11 @@ class Minify_HTML {
|
||||
|
||||
$html = str_replace("\r\n", "\n", trim($html));
|
||||
|
||||
self::$_isXhtml = (false !== strpos($html, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML'));
|
||||
self::$_isXhtml = (
|
||||
isset($options['xhtml'])
|
||||
? (bool)$options['xhtml']
|
||||
: (false !== strpos($html, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML'))
|
||||
);
|
||||
|
||||
self::$_replacementHash = 'MINIFYHTML' . md5(time());
|
||||
self::$_placeholders = array();
|
||||
|
Reference in New Issue
Block a user