Posted By

noah on 09/16/09


Tagged

valid css check test testing code validation BDD validator client TDD tools stylesheets w3 webdev unit w3c lint linter


Versions (?)

How to configure the output format of the W3 CSS Validator


 / Published in: Other
 

URL: http://dev.w3.org/cvsweb/~checkout~/2002/css-validator/org/w3c/css/css/format.properties?rev=1.10&content-type=text/plain

The W3 CSS validator is pretty simple to install locally for use behind the firewall.

However, by default the validator spits out the whole CSS file after validation, which is inconvenient if your stylesheet is more than a few lines long.

Unfortunately it's not so obvious how to configure the validator to give pretty-printed, human-readable output. In fact, all there is to it, is to choose a different output format from the several that are supported :)

By default the validator .jar file gives you "text" output, which includes the stylesheet. To choose a different format, invoke the validator .jar file with an -output argument, like this:

java -jar css-validator.jar -output <FORMAT> local-file:foo.css

where <FORMAT> is any of xhtml, xml, text, soap12, json, ucn or gnu

If you just want the errors as (html-escaped) plain text, but without the CSS included, use gnu

  1. java -jar css-validator.jar -output gnu local-file:foo.css
  2.  
  3. java -jar css-validator.jar -output json http://onemorebug.com/css/index.css

Report this snippet  

You need to login to post a comment.