Posted By

noah on 09/16/09


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


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
  3. java -jar css-validator.jar -output json

Report this snippet  

You need to login to post a comment.