Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any command line validation tools for HTML and CSS? [closed]

Is anyone aware of command line tools that can validate CSS and/or HTML?

The W3C offers its validators for local installation, with directions to use from the command line, but the installation process is a nightmare for anyone who isn't a seasoned Java developer.

I've searched with Google, but can't find anything.

Ideally I'd like to use a tool (or tools) that I can point at my CSS, and have it report back on any errors. I want it to be local to increase the speed of my debugging cycles.

Ideally, the tools will understand HTML5 and CSS3.

like image 358
Robert Avatar asked Jul 11 '11 05:07

Robert


People also ask

How do I validate HTML and CSS code?

You can validate both HTML and CSS files. You can use any commercial software package or free online application, such as the following World Wide Web Consortium (W3C) validators: W3C CSS Validator at http://jigsaw.w3.org/css-validator/ W3C HTML Validator at http://validator.w3.org/

What tool is used to check HTML validity?

An HTML validator is a quality assurance program used to check Hypertext Markup Language ( HTML ) markup elements for syntax errors. A validator can be a useful tool for an HTML user who receives data electronically from a variety of input sources.

Is there a CSS validator?

The W3C CSS Validation Service can be used to check the correctness (validity) of W3. CSS. The Validation Service was created by the W3C to help Web developers validate CSS.


1 Answers

There is tidy for HTML. It's more than a validator: it doesn't only check if your HTML is valid, but also tries to fix it. But you can just look at the errors and warnings and ignore the fix if you want.

I'm not sure how well it works with HTML5, but take a look at Wanted: Command line HTML5 beautifier, there are some parameter suggestions.

For CSS there is CSSTidy (I have never used it though.)

Regarding the W3C validator: if you happen to use debian/ubuntu, the package w3c-markup-validator is in the repositories and very easy to install via package management. Packages for other distos are also available.

And the W3C CSS validator is available as a jar, which is easy to use:

java -jar css-validator.jar http://www.w3.org/.  
like image 141
Dario Seidl Avatar answered Sep 21 '22 14:09

Dario Seidl