mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 04:23:01 +00:00
minify_css: minor improvements
", " -> "," "0." -> "."
This commit is contained in:
parent
54250e71db
commit
607c9f8529
1 changed files with 5 additions and 3 deletions
|
@ -627,7 +627,7 @@ function render_editor($editorName) {
|
||||||
* @param string $css_str The string of CSS to minify.
|
* @param string $css_str The string of CSS to minify.
|
||||||
* @return string The minified CSS string.
|
* @return string The minified CSS string.
|
||||||
*/
|
*/
|
||||||
function minify_css($css_str) {
|
function minify_css(string $css_str) : string {
|
||||||
// Remove comments
|
// Remove comments
|
||||||
$result = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', "", $css_str);
|
$result = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', "", $css_str);
|
||||||
// Cut down whitespace
|
// Cut down whitespace
|
||||||
|
@ -635,10 +635,12 @@ function minify_css($css_str) {
|
||||||
// Remove whitespace after colons and semicolons
|
// Remove whitespace after colons and semicolons
|
||||||
$result = str_replace([
|
$result = str_replace([
|
||||||
" :", ": ", "; ",
|
" :", ": ", "; ",
|
||||||
" { ", " } ", "{ ", " {", "} ", " }"
|
" { ", " } ", "{ ", " {", "} ", " }",
|
||||||
|
", ", "0."
|
||||||
], [
|
], [
|
||||||
":", ":", ";",
|
":", ":", ";",
|
||||||
"{", "}", "{", "{", "}", "}"
|
"{", "}", "{", "{", "}", "}",
|
||||||
|
",", "."
|
||||||
], $result);
|
], $result);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue