mirror of
https://github.com/mrclay/minify.git
synced 2025-08-13 01:24:51 +02:00
Source.php now strips leading UTF-8 BOMs and added BOMs to javascript test files to test this, and note in README.
This commit is contained in:
6
README
6
README
@@ -65,3 +65,9 @@ MINIFY USAGE
|
|||||||
Example 1 shows an example of using Minify to serve external CSS and JS files
|
Example 1 shows an example of using Minify to serve external CSS and JS files
|
||||||
with far-off Expires headers. Clients will always have up-to-date versions
|
with far-off Expires headers. Clients will always have up-to-date versions
|
||||||
because Minify_Build is used to time stamp the URLs.
|
because Minify_Build is used to time stamp the URLs.
|
||||||
|
|
||||||
|
FILE ENCODINGS
|
||||||
|
|
||||||
|
Minify *should* work fine with files encoded in UTF-8 or other 8-bit
|
||||||
|
encodings like ISO 8859/Windows-1252. Leading UTF-8 BOMs are stripped from
|
||||||
|
all sources to prevent duplication in output files.
|
||||||
|
@@ -78,12 +78,16 @@ class Minify_Source {
|
|||||||
*/
|
*/
|
||||||
public function getContent()
|
public function getContent()
|
||||||
{
|
{
|
||||||
return (null !== $this->_filepath)
|
$content = (null !== $this->_filepath)
|
||||||
? file_get_contents($this->_filepath)
|
? file_get_contents($this->_filepath)
|
||||||
: ((null !== $this->_content)
|
: ((null !== $this->_content)
|
||||||
? $this->_content
|
? $this->_content
|
||||||
: call_user_func($this->_getContentFunc, $this->_id)
|
: call_user_func($this->_getContentFunc, $this->_id)
|
||||||
);
|
);
|
||||||
|
// remove UTF-8 BOM if present
|
||||||
|
return (pack("CCC",0xef,0xbb,0xbf) === substr($content, 0, 3))
|
||||||
|
? substr($content, 3)
|
||||||
|
: $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
var MrClay = window.MrClay || {};
|
var MrClay = window.MrClay || {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simplified access to/manipulation of the query string
|
* Simplified access to/manipulation of the query string
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// http://mrclay.org/
|
// http://mrclay.org/
|
||||||
(function(){
|
(function(){
|
||||||
var
|
var
|
||||||
reMailto = /^mailto:my_name_is_(\S+)_and_the_domain_is_(\S+)$/,
|
reMailto = /^mailto:my_name_is_(\S+)_and_the_domain_is_(\S+)$/,
|
||||||
|
Reference in New Issue
Block a user