The Code Train

Where Neil Crosby talks about coding on the train…

RSS Entries

Running the W3C CSS Validator locally from the command line

Posted on February 18th, 2009 by Neil Crosby. Filed under Blog Posts.

One of the things I’m currently working on is being able to run automated tests of FrontEnd Web Systems. In order to carry out the first phase of this testing I need local installations of the HTML Validator, CSS Validator and JsLint (when automatically running these tests many times a day it’s not fair to put that load on these free services).

I’m currently working on the CSS portion of the First Phase, so I’ve been looking at getting the W3C CSS Validator running locally on my machine. Since there was a tiny bit more to it than there seemed from the W3C’s setup instructions, I thought I’d better write down how I did it.

  1. Download the Jigsaw web server and unzip it to a location of your choice. We’ll be needing the servlet.jar file from it later (it’s in Jigsaw 2/classes/servlet.jar)

  2. Open a terminal window, and change directory to somewhere you’re happy to put the CSS Validator. The CVS password, when prompted, is “anonymous”. cvs login cvs checkout \
    cd 2002/css-validator
    mkdir lib
    cp {your servelet.jar location} lib
    ant jar
  3. Assuming nothing goes wrong, you’ve got yourself a self-contained, offline CSS Validator. Awesome.

  4. Test the validator by running the following:

    java -jar css-validator.jar --output=soap12
  5. By running the following, you can see the options available to you from the validator:

    java -jar css-validator.jar

    These options are explained in the CSS Validator User Manual.

And that, as they say, is all there is to it. From this, it shouldn’t be too difficult to set the validator up to run as a website if you want to, but that wasn’t necessary for me right now, so I didn’t do it myself.

Tags: , , , , , ,

If you enjoyed this post, subscribe to The Code Train and read more when I write more.

2 Responses to “Running the W3C CSS Validator locally from the command line”

  1. Hi, Nice write up I have some doubts, I tried Unicorn. I can`t able to use Unicorn fully locally. I don’t want to setup a server. Please tell me How to setup the different validators locally.

  2. Oh my goodness! Impressive article dude! Thank you so much, However I am encountering problems with your RSS. I don’t know why I am unable to join it. Is there anybody else having the same RSS problems? Anyone who knows the solution can you kindly respond? Thanks!!

Comments RSS

Leave a Reply

TheCodeTrain Theme by Neil Crosby, Powered by WordPress