PHP Класс MatthiasMullie\Minify\CSS

Please report bugs on https://github.com/matthiasmullie/minify/issues
Автор: Matthias Mullie ([email protected])
Автор: Tijs Verkoyen ([email protected])
Наследование: extends Minify
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$importExtensions string[]
$maxImportSize integer

Открытые методы

Метод Описание
execute ( string[optional] $path = null, string[] $parents = [] ) : string Minify the data.
setImportExtensions ( array $extensions ) Set the type of extensions to be imported into the CSS (to save network connections).
setMaxImportSize ( integer $size ) Set the maximum size if files to be imported.

Защищенные методы

Метод Описание
canImportBySize ( string $path ) : boolean Check if file is small enough to be imported.
combineImports ( string $source, string $content, string[] $parents ) : string Combine CSS from import statements.
importFiles ( string $source, string $content ) : string Import files into the CSS, base64-ized.
move ( MatthiasMullie\PathConverter\Converter $converter, string $content ) : string Moving a css file should update all relative urls.
moveImportsToTop ( string $content ) : string Move any import statements to the top.
shortenFontWeights ( string $content ) : string Shorten CSS font weights.
shortenHex ( string $content ) : string Shorthand hex color codes.
shortenZeroes ( string $content ) : string Shorthand 0 values to plain 0, instead of e.g. -0em.
stripComments ( ) Strip comments from source code.
stripEmptyTags ( string $content ) : string Strip comments from source code.
stripWhitespace ( string $content ) : string Strip whitespace.

Описание методов

canImportBySize() защищенный Метод

Check if file is small enough to be imported.
protected canImportBySize ( string $path ) : boolean
$path string The path to the file
Результат boolean

combineImports() защищенный Метод

Combine CSS from import statements.
protected combineImports ( string $source, string $content, string[] $parents ) : string
$source string The file to combine imports for
$content string The CSS content to combine imports for
$parents string[] Parent paths, for circular reference checks
Результат string

execute() публичный Метод

Perform CSS optimizations.
public execute ( string[optional] $path = null, string[] $parents = [] ) : string
$path string[optional]
$parents string[] Parent paths, for circular reference checks
Результат string The minified data

importFiles() защищенный Метод

Import files into the CSS, base64-ized.
protected importFiles ( string $source, string $content ) : string
$source string The file to import files for
$content string The CSS content to import files for
Результат string

move() защищенный Метод

Relative references (e.g. ../images/image.gif) in a certain css file, will have to be updated when a file is being saved at another location (e.g. ../../images/image.gif, if the new CSS file is 1 folder deeper).
protected move ( MatthiasMullie\PathConverter\Converter $converter, string $content ) : string
$converter MatthiasMullie\PathConverter\Converter Relative path converter
$content string The CSS content to update relative urls for
Результат string

moveImportsToTop() защищенный Метод

Move any import statements to the top.
protected moveImportsToTop ( string $content ) : string
$content string Nearly finished CSS content
Результат string

setImportExtensions() публичный Метод

Keys of the array should be the file extensions & respective values should be the data type.
public setImportExtensions ( array $extensions )
$extensions array Array of file extensions

setMaxImportSize() публичный Метод

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.
public setMaxImportSize ( integer $size )
$size integer Size in kB

shortenFontWeights() защищенный Метод

Shorten CSS font weights.
protected shortenFontWeights ( string $content ) : string
$content string The CSS content to shorten the font weights for
Результат string

shortenHex() защищенный Метод

#FF0000 -> #F00.
protected shortenHex ( string $content ) : string
$content string The CSS content to shorten the hex color codes for
Результат string

shortenZeroes() защищенный Метод

Shorthand 0 values to plain 0, instead of e.g. -0em.
protected shortenZeroes ( string $content ) : string
$content string The CSS content to shorten the zero values for
Результат string

stripComments() защищенный Метод

Strip comments from source code.
protected stripComments ( )

stripEmptyTags() защищенный Метод

Strip comments from source code.
protected stripEmptyTags ( string $content ) : string
$content string
Результат string

stripWhitespace() защищенный Метод

Strip whitespace.
protected stripWhitespace ( string $content ) : string
$content string The CSS content to strip the whitespace for
Результат string

Описание свойств

$importExtensions защищенное свойство

protected string[] $importExtensions
Результат string[]

$maxImportSize защищенное свойство

protected int $maxImportSize
Результат integer