MatthiasMullie\Minify\CSS::shortenFontWeights PHP Method

shortenFontWeights() protected method

Shorten CSS font weights.
protected shortenFontWeights ( string $content ) : string
$content string The CSS content to shorten the font weights for
return string
    protected function shortenFontWeights($content)
    {
        $weights = array('normal' => 400, 'bold' => 700);
        $callback = function ($match) use($weights) {
            return $match[1] . $weights[$match[2]];
        };
        return preg_replace_callback('/(font-weight\\s*:\\s*)(' . implode('|', array_keys($weights)) . ')(?=[;}])/', $callback, $content);
    }