Created
September 25, 2012 19:07
-
-
Save roborourke/3783815 to your computer and use it in GitHub Desktop.
lesscss-parser erro workaround
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$lessc = new lessc(); | |
$lessc->registerFunction('foo', function($arg) { | |
list($type, $delimiter, $values) = $arg; | |
// $values is not flat array when using variables within arguments | |
// We cannot easily read the compiled value | |
$string = 'mod-'; | |
if ( is_array( $values ) ) { | |
foreach( $values as $value ) { | |
if ( is_string( $value ) ) $string .= $value; | |
if ( is_array( $value ) && $value[0] == 'string' ) $string .= implode( ' ', $value[2] ); | |
} | |
} | |
print_r($values); | |
return array($type, $delimiter, (array)$string); | |
}); | |
$css = <<<EOD | |
@bar: ~"something"; | |
.selector { | |
src: foo('boom.eot'); | |
src: foo('@{bar}.eot'); | |
} | |
EOD; | |
echo $lessc->parse($css); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment