Search code examples
cssvalidationw3c-validationcsslint

CSS validator where you can disable error messages on per file basis


Does there exist a CSS validator where one could hint inside a file, á la jslint, what validation rules are and are not effective inside this file or a rule.

I tried

  • W3C validator

  • csslint

Neither of them offers this functionality and always lead to validation errors for a mark-up which one wants to use (IE hacks, vendor extensions)

To clarify matters further: I'd like to use this validator in a commit hook to catch CSS which does not conform the project policy. I am not that interested if people think if vendor prefixes are good or bad.


Solution

  • I don't believe there is a tool out there that's sophisticated enough to find all stylesheets that your page links to and offer customized validation rules for each stylesheet.

    What I always do is isolate my IE hacks in a separate file, hidden in a conditional comment, so the validator never sees them even if I pass the URI of my page which links to all its stylesheets.

    For vendor prefixes, you can tell the W3C validator to raise warnings instead of errors, although you won't be able to get it to outright ignore them because they simply do not validate.