minify/src/70530246-2903-4c02-af9a-611.../README.md

175 lines
4.9 KiB
Markdown
Raw Normal View History

2023-04-15 14:58:37 +00:00
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# class Css (Details)
> namespace: **VDM\Minify**
```uml
@startuml
class Css #Gold {
# $maxImportSize
+ setMaxImportSize(int $size)
+ setImportExtensions(array $extensions)
# moveImportsToTop(string $content) : string
# combineImports(string $source, string $content, ...) : string
# importFiles(string $source, string $content) : string
+ execute(string[optional] $path = null, string[] $parents = []) : string
# move(ConverterInterface $converter, string $content) : string
# shortenColors(string $content) : string
# shortenFontWeights(string $content) : string
# shortenZeroes(string $content) : string
# stripEmptyTags(string $content) : string
# stripComments()
# stripWhitespace(string $content) : string
# extractMath()
# extractCustomProperties()
# canImportBySize(string $path) : bool
# canImportByPath(string $path) : bool
# getPathConverter(string $source, string $target) : ConverterInterface
}
note right of Css::setMaxImportSize
Set the maximum size if files to be imported.
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.
end note
note left of Css::setImportExtensions
Set the type of extensions to be imported into the CSS (to save network
connections).
Keys of the array should be the file extensions & respective values
should be the data type.
end note
note right of Css::moveImportsToTop
Move any import statements to the top.
return: string
end note
note left of Css::combineImports
Combine CSS from import statements.
Import statements will be loaded and their content merged into the original
file, to save HTTP requests.
return: string
arguments:
string $source
string $content
string[] $parents
end note
note right of Css::importFiles
Import files into the CSS, base64-ized.
original file, to save HTTP requests.
return: string
end note
note left of Css::execute
Minify the data.
Perform CSS optimizations.
return: string
end note
note right of Css::move
Moving a css file should update all relative urls.
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).
return: string
end note
note left of Css::shortenColors
Shorthand hex color codes.
#FF0000 -> #F00.
return: string
end note
note right of Css::shortenFontWeights
Shorten CSS font weights.
return: string
end note
note left of Css::shortenZeroes
Shorthand 0 values to plain 0, instead of e.g. -0em.
return: string
end note
note right of Css::stripEmptyTags
Strip empty tags from source code.
return: string
end note
note left of Css::stripComments
Strip comments from source code.
end note
note right of Css::stripWhitespace
Strip whitespace.
return: string
end note
note left of Css::extractMath
Replace all occurrences of functions that may contain math, where
whitespace around operators needs to be preserved (e.g. calc, clamp).
end note
note right of Css::extractCustomProperties
Replace custom properties, whose values may be used in scenarios where
we wouldn't want them to be minified (e.g. inside calc).
end note
note left of Css::canImportBySize
Check if file is small enough to be imported.
return: bool
end note
note right of Css::canImportByPath
Check if file a file can be imported, going by the path.
return: bool
end note
note left of Css::getPathConverter
Return a converter to update relative paths to be relative to the new
destination.
return: ConverterInterface
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)