So for example I could do like this with it :
$css = new simple_css();
foreach ($css->find_elements_with_property('margin') as $element) {
//do my stuff
if ($something) {
$elem->spacing = '1px';
}
}
$processed_css = $css->plaintext();
So for example I could do like this with it :
$css = new simple_css();
foreach ($css->find_elements_with_property('margin') as $element) {
//do my stuff
if ($something) {
$elem->spacing = '1px';
}
}
$processed_css = $css->plaintext();
I searched phpclasses.org:
<?php
include("cssparser.php");
$css = new cssparser();
$css->ParseStr("b {font-weight: bold; color: #777777;} b.test{text-decoration: underline;}");
echo $css->Get("b","color"); // returns #777777
echo $css->Get("b.test","color");// returns #777777
echo $css->Get(".test","color"); // returns an empty string
?>
Link: http://www.phpclasses.org/package/1289-PHP-CSS-parser-class.html
I'm only aware of two projects:
I haven't really used any of them.
Not sure if this is of any use? sabberworm... available on github https://github.com/sabberworm/PHP-CSS-Parser, havent used it myself but a college has and mentioned it was useful...
It's not the same but with LESS (that is the only stable project that I know on the subject) you van achieve the same by using mixins with guards.
Take a look http://lesscss.org/#docs
Hope this helps