public static function minify($buffer)
    {
        $search = [
            // Strip whitespaces after tags, except space
            '/\>[^\S]+/s',

            // Strip whitespaces before tags, except space
            '/[^\S]+\</s',

            // Shorten multiple whitespace sequences
            '/(\s)+/s',
        ];

        $replace = [
            '>',
            '<',
            '\\1',
        ];

        $buffer = preg_replace($search, $replace, $buffer);

        return $buffer;
    }