<?php
$input = <<<CSS
/* Language specific height correction for titles. Ref T31405 and T32809 */
/* Languages like hi or ml require slightly more vertical space to show diacritics properly */
h1:lang( anp ),
h1:lang( as ),
h1:lang( bh ), /* Macrolanguage, used on bh.wikipedia.org, should be removed one day */
h1:lang( bho ),
h1:lang( bn ),
h1:lang( gu ),
h1:lang( hi ),
h1:lang( kn ),
h1:lang( ks ),
h1:lang( ml ),
h1:lang( mr ),
h1:lang( my ),
h1:lang( mai ),
h1:lang( ne ),
h1:lang( new ),
h1:lang( or ),
h1:lang( pa ),
h1:lang( pi ),
h1:lang( sa ),
h1:lang( ta ),
h1:lang( te ) {
line-height: 1.6em !important; /* stylelint-disable-line declaration-no-important */
}
/* stylelint-disable selector-list-comma-newline-after */
h2:lang( anp ), h3:lang( anp ), h4:lang( anp ), h5:lang( anp ), h6:lang( anp ),
h2:lang( as ), h3:lang( as ), h4:lang( as ), h5:lang( as ), h6:lang( as ),
h2:lang( bho ), h3:lang( bho ), h4:lang( bho ), h5:lang( bho ), h6:lang( bho ),
h2:lang( bh ), h3:lang( bh ), h4:lang( bh ), h5:lang( bh ), h6:lang( bh ),
h2:lang( bn ), h3:lang( bn ), h4:lang( bn ), h5:lang( bn ), h6:lang( bn ),
h2:lang( gu ), h3:lang( gu ), h4:lang( gu ), h5:lang( gu ), h6:lang( gu ),
h2:lang( hi ), h3:lang( hi ), h4:lang( hi ), h5:lang( hi ), h6:lang( hi ),
h2:lang( kn ), h3:lang( kn ), h4:lang( kn ), h5:lang( kn ), h6:lang( kn ),
h2:lang( ks ), h3:lang( ks ), h4:lang( ks ), h5:lang( ks ), h6:lang( ks ),
h2:lang( ml ), h3:lang( ml ), h4:lang( ml ), h5:lang( ml ), h6:lang( ml ),
h2:lang( mr ), h3:lang( mr ), h4:lang( mr ), h5:lang( mr ), h6:lang( mr ),
h2:lang( my ), h3:lang( my ), h4:lang( my ), h5:lang( my ), h6:lang( my ),
h2:lang( mai ), h3:lang( mai ), h4:lang( mai ), h5:lang( mai ), h6:lang( mai ),
h2:lang( ne ), h3:lang( ne ), h4:lang( ne ), h5:lang( ne ), h6:lang( ne ),
h2:lang( new ), h3:lang( new ), h4:lang( new ), h5:lang( new ), h6:lang( new ),
h2:lang( or ), h3:lang( or ), h4:lang( or ), h5:lang( or ), h6:lang( or ),
h2:lang( pa ), h3:lang( pa ), h4:lang( pa ), h5:lang( pa ), h6:lang( pa ),
h2:lang( pi ), h3:lang( pi ), h4:lang( pi ), h5:lang( pi ), h6:lang( pi ),
h2:lang( sa ), h3:lang( sa ), h4:lang( sa ), h5:lang( sa ), h6:lang( sa ),
h2:lang( ta ), h3:lang( ta ), h4:lang( ta ), h5:lang( ta ), h6:lang( ta ),
h2:lang( te ), h3:lang( te ), h4:lang( te ), h5:lang( te ), h6:lang( te ) {
line-height: 1.2em;
}
/* stylelint-enable selector-list-comma-newline-after */
CSS;
class CSSMin {
public static function minify( $css ) {
return trim(
str_replace(
[ '; ', ': ', ' {', '{ ', ', ', '} ', ';}', '( ', ' )', '[ ', ' ]' ],
[ ';', ':', '{', '{', ',', '}', '}', '(', ')', '[', ']' ],
preg_replace( [ '/\s+/', '/\/\*.*?\*\//s' ], [ ' ', '' ], $css )
)
);
}
}
$min = CSSMin::minify($input);
$minz = gzdeflate($min, 9);
echo "transfer size: " . strlen($minz) . "\n";
echo "decompressed: " . strlen($min) . "\n";
- Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
- transfer size: 300
decompressed: 1587
preferences:
74.95 ms | 407 KiB | 5 Q