CSSTidy, HTMLTidy, JSlint pre-commit hooks(Hg) - automation tools
I am looking for a way to test/validate my html
, css
, js
before开发者_如何学Python they are committed to a repository.
Is there any way to automate this process. Ideally, I would like to have the ability to exclude certain files (js libraries for example).
I've written jslint4java, which wraps Doug Crockford's JSLint in a way which makes it simply to invoke from a command line or ant build. That should be fairly easy to plug into a pre-commit hook. Have a look at this example of a JSLint pre-commit hook. Excluding files should be a fairly small addition.
I'm less sure about CSS and HTML validation. You can download the W3C CSS validator, and again set up a pre-commit hook to call that on CSS files. The W3C HTML validator is slightly harder to get running as it relies on nsgmls being installed (part of OpenJade, I think). You may have better luck with the HTML5 validator. You may have better luck with the HTML5 validator.
精彩评论