wikimedia/minify
Minification of JavaScript code and CSS stylesheets
|
Transforms CSS data. More...
Static Public Member Functions | |
static | getLocalFileReferences ( $source, $path) |
Get a list of local files referenced in a stylesheet (includes non-existent files). | |
static | encodeImageAsDataURI ( $file, $type=null) |
Encode an image file as a data URI. | |
static | encodeStringAsDataURI ( $contents, $type) |
Encode file contents as a data URI with chosen MIME type. | |
static | serializeStringValue ( $value) |
Serialize a string (escape and quote) for use as a CSS string value. | |
static | getMimeType ( $file) |
static | buildUrlValue ( $url) |
Build a CSS 'url()' value for the given URL, quoting parentheses (and other funny characters) and escaping quotes as necessary. | |
static | remap ( $source, $local, $remote, $embedData=true) |
Remaps CSS URL paths and automatically embeds data URIs for CSS rules or url() values preceded by an / * @embed * / comment. | |
static | remapOne ( $file, $query, $local, $remote, $embed) |
Remap or embed a CSS URL path. | |
static | minify ( $css) |
Removes whitespace from CSS data. | |
Static Protected Member Functions | |
static | isRemoteUrl ( $maybeUrl) |
Is this CSS rule referencing a remote URL? | |
static | isLocalUrl ( $maybeUrl) |
Is this CSS rule referencing a local URL? | |
Transforms CSS data.
This class provides minification, URL remapping, URL extracting, and data-URL embedding.
|
static |
Build a CSS 'url()' value for the given URL, quoting parentheses (and other funny characters) and escaping quotes as necessary.
See http://www.w3.org/TR/css-syntax-3/#consume-a-url-token
string | $url | URL to process |
"url($url)"
, quoted/escaped if necessary
|
static |
Encode an image file as a data URI.
If the image file has a suitable MIME type and size, encode it as a data URI, base64-encoded for binary files or just percent-encoded otherwise. Return false if the image type is unfamiliar or the file exceeds the size limit.
string | $file | Image file to encode. |
string | null | $type | File's MIME type or null. If null, CSSMin will try to autodetect the type. |
|
static |
Encode file contents as a data URI with chosen MIME type.
The URI will be base64-encoded for binary files or just percent-encoded otherwise.
string | $contents | File contents to encode. |
string | $type | File's MIME type. |
|
static |
Get a list of local files referenced in a stylesheet (includes non-existent files).
string | $source | CSS stylesheet source to process |
string | $path | File path where the source was read from |
|
static |
string | $file |
|
staticprotected |
Is this CSS rule referencing a local URL?
string | $maybeUrl |
|
staticprotected |
Is this CSS rule referencing a remote URL?
string | $maybeUrl |
|
static |
Removes whitespace from CSS data.
string | $css | CSS data to minify |
|
static |
Remaps CSS URL paths and automatically embeds data URIs for CSS rules or url() values preceded by an / * @embed * /
comment.
string | $source | CSS data to remap |
string | $local | File path where the source was read from |
string | $remote | Full URL to the file's directory (may be protocol-relative, trailing slash is optional) |
bool | $embedData | If false, never do any data URI embedding, even if / * @embed * / is found. |
|
static |
Remap or embed a CSS URL path.
string | $file | URL to remap/embed |
string | $query | |
string | $local | File path where the source was read from |
string | $remote | Full URL to the file's directory (may be protocol-relative, trailing slash is optional) |
bool | $embed | Whether to do any data URI embedding |
|
static |
Serialize a string (escape and quote) for use as a CSS string value.
https://drafts.csswg.org/cssom/#serialize-a-string
string | $value |