I'm trying to parse a CSS file with the Raphael Schweikert's lib Sabberworm\PHP-CSS-PARSE
But I'm blocked with object manipulations. What I'm trying to do is to convert this css file:
.header {
background: #000;
}
.footer, .wrapper {
background: #ebebeb;
}
In a PHP/JSON like format:
'.header' => "background: #000;",
'.footer' => "background: #ebebeb;",
'.wrapper' => "background: #ebebeb;"
What i did:
<?php
require 'vendor/autoload.php';
$oCssParser = new Sabberworm\CSS\Parser(file_get_contents('style.css'));
$oCssDocument = $oCssParser->parse();
$selectors=$oCssDocument->getAllRuleSets();
...
but how to loop after ? The structure of the object is not easy for a neewbe like me...