How Can I Validate CSS Within A Script?
Is there a library out there which will validate CSS? The only tools I can find to do so are web sites. If one of these sites has an API, that would fit the bill, too. I have a scr
Solution 1:
W3C has an API:
http://jigsaw.w3.org/css-validator/api.html
You can also download the validator and run it locally: http://jigsaw.w3.org/css-validator/DOWNLOAD.html
You need to be able to run java from your script.
Solution 2:
Python library:
Solution 3:
There is a pear package called Services_W3C_CSSValidator which does this. You can download the PHP class directly from the github if you prefer.
Its very simple to use.
require_once 'Services/W3C/CSSValidator.php';
$v = new Services_W3C_CSSValidator();
$result = $v->validateFile('pear_manual.css'); // XML
It includes all features available at http://jigsaw.w3.org/css-validator
Post a Comment for "How Can I Validate CSS Within A Script?"