开发者

CSSTidy, HTMLTidy, JSlint pre-commit hooks(Hg) - automation tools

开发者 https://www.devze.com 2022-12-24 01:53 出处:网络
I am looking for a way to test/validate my html, css, js before开发者_如何学Python they are committed to a repository.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号