Created
October 4, 2015 13:54
-
-
Save apperceive/cd130ea479fd6fca7ae4 to your computer and use it in GitHub Desktop.
Simple example to dump all selectors using Sabberworm CSS parser
This file contains hidden or 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 | |
require_once(dirname(__FILE__).'/bootstrap.php'); | |
$oParser = new Sabberworm\CSS\Parser(file_get_contents('php://stdin')); | |
$oCss = $oParser->parse(); | |
foreach($oCss->getAllDeclarationBlocks() as $oBlock) { | |
foreach($oBlock->getSelectors() as $oSelector) { | |
print $oSelector->getSelector() . "\n"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For use with @sabberworm's PHP-CSS-Parser
Command line usage assuming proper parser install:
curl http://example.com | php seldump.php > selectors.txt