CSS
extends Minify
in package
CSS minifier.
Please report bugs on https://github.com/matthiasmullie/minify/issues
Tags
Table of Contents
Methods
- __construct() : mixed
- Init the minify class - optionally, code may be passed along already.
- add() : static
- Add a file or straight-up code to be minified.
- addFile() : static
- Add a file to be minified.
- cache() : CacheItemInterface
- Minify the data & write it to a CacheItemInterface object.
- execute() : string
- Minify the data.
- gzip() : string
- Minify & gzip the data & (optionally) saves it to a file.
- minify() : string
- Minify the data & (optionally) saves it to a file.
- setImportExtensions() : mixed
- Set the type of extensions to be imported into the CSS (to save network connections).
- setMaxImportSize() : mixed
- Set the maximum size if files to be imported.
Methods
__construct()
Init the minify class - optionally, code may be passed along already.
public
__construct() : mixed
add()
Add a file or straight-up code to be minified.
public
add(string|array<string|int, string> $data) : static
Parameters
- $data : string|array<string|int, string>
Return values
staticaddFile()
Add a file to be minified.
public
addFile(string|array<string|int, string> $data) : static
Parameters
- $data : string|array<string|int, string>
Tags
Return values
staticcache()
Minify the data & write it to a CacheItemInterface object.
public
cache(CacheItemInterface $item) : CacheItemInterface
Parameters
- $item : CacheItemInterface
-
Cache item to write the data to
Return values
CacheItemInterface —Cache item with the minifier data
execute()
Minify the data.
public
execute([mixed $path = null ][, array<string|int, string> $parents = array() ]) : string
Perform CSS optimizations.
Parameters
- $path : mixed = null
-
Path to write the data to
- $parents : array<string|int, string> = array()
-
Parent paths, for circular reference checks
Return values
string —The minified data
gzip()
Minify & gzip the data & (optionally) saves it to a file.
public
gzip([mixed $path = null ][, mixed $level = 9 ]) : string
Parameters
- $path : mixed = null
-
Path to write the data to
- $level : mixed = 9
-
Compression level, from 0 to 9
Return values
string —The minified & gzipped data
minify()
Minify the data & (optionally) saves it to a file.
public
minify([mixed $path = null ]) : string
Parameters
- $path : mixed = null
-
Path to write the data to
Return values
string —The minified data
setImportExtensions()
Set the type of extensions to be imported into the CSS (to save network connections).
public
setImportExtensions(array<string|int, string> $extensions) : mixed
Keys of the array should be the file extensions & respective values should be the data type.
Parameters
- $extensions : array<string|int, string>
-
Array of file extensions
setMaxImportSize()
Set the maximum size if files to be imported.
public
setMaxImportSize(int $size) : mixed
Files larger than this size (in kB) will not be imported into the CSS. Importing files into the CSS as data-uri will save you some connections, but we should only import relatively small decorative images so that our CSS file doesn't get too bulky.
Parameters
- $size : int
-
Size in kB