oscarotero/stylecow

Problems parsing icon font css

Closed this issue · 1 comments

I have a problem parsing a css with information about icon font positions.

Seems that content: "\f019" is returned as content: "\f019; without the close quote.

Full example:

use Stylecow\Parser;

//A simple PSR-0 autoload function
function autoload ($className) {
    $className = ltrim($className, '\\');
    $fileName  = '';
    $namespace = '';
    
    if ($lastNsPos = strripos($className, '\\')) {
        $namespace = substr($className, 0, $lastNsPos);
        $className = substr($className, $lastNsPos + 1);
        $fileName  = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
    }

    $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';

    if (is_file($fileName)) {
        require $fileName;
    }
}

spl_autoload_register('autoload');

//Load and parse the code
$Css = \Stylecow\Parser::parseString(file_get_contents('https://raw.github.com/FortAwesome/Font-Awesome/master/css/font-awesome.min.css'));

//Transform the css code using the plugins.
$Css->applyPlugins(array(
    'Rem',
    'Variables',
    'VendorPrefixes'
));

//Print the result css code
echo $Css;

Can be a problem parsing the \f as only one character?

Fixed! Thanks.