README.md in headhunter-0.0.8 vs README.md in headhunter-0.0.9
- old
+ new
@@ -6,10 +6,12 @@
Headhunter is an HTML and CSS validation tool that injects itself into your Rails feature tests and automagically checks all your generated HTML and CSS for validity.
In addition, it also looks out for unused (and therefore superfluous) CSS selectors.
+This is all done **locally**, so no external service is used.
+
## How to use
Add Headhunter to your `Gemfile`:
```ruby
@@ -18,13 +20,13 @@
end
```
Just set the environment variable `HEADHUNTER` to `true` when running your tests, e.g.:
-- `rake HEADHUNTER=true`
-- `rspec HEADHUNTER=true`
-- `cucumber HEADHUNTER=true`
+```
+$ rake HEADHUNTER=true
+```
Headhunter doesn't keep your tests from passing if invalid HTML or unused CSS is found. Instead it displays a short statistic after the tests are run.
$ rake HEADHUNTER=true
@@ -41,11 +43,11 @@
Open .validation/results.html to view full results.
Validated 1 stylesheets.
1 stylesheet is invalid.
application.css:
- - Invalid css: line 1: Property bla doesn't exist
+ - Line 1: Property bla doesn't exist
Found 23 CSS selectors.
20 selectors are in use.
3 selectors are not in use: a img, #flash.failure, input[type='file']
@@ -59,25 +61,25 @@
## Requirements
**[Tidy HTML](http://tidy.sourceforge.net/)** should be installed on a typical OSX and Linux installation already. You're not developing on a Windows machine, are you?! If you want to validate HTML5 (and you should want to!), install the HTML5 version like described here: [homebrew tidy html5](http://techblog.willshouse.com/2013/10/21/homebrew-tidy-html5/).
-You need a **working internet connection** to run CSS validation. As a Rails application typically contains one single CSS file (`application.css`), this won't have much impact on the speed of your tests.
+You need a **Java Runtime Environment** to run CSS validation. This should normally already be available on OSX and Linux machines, too. A local copy (`[css-validator.jar](http://jigsaw.w3.org/css-validator/DOWNLOAD.html)`) of the [W3 CSS Validation Service](http://jigsaw.w3.org/css-validator/) is used.
## Known issues and future plans
- It would be nice to use Rails' own assets compilation that's executed when the first JavaScript test is run. Anyone has an idea on how to do this?
-- At the moment, in addition to precompiling and removing your assets, `rake assets:clobber` is run also **before** precompiling! The issue is explained here: [Rake assets are generated twice when precompiling them once from command line and once from within a Ruby script](http://stackoverflow.com/questions/20938891/rake-assets-are-generated-twice-when-precompiling-them-once-from-command-line-an)
-- Instead of running `rake assets:clobber`, it may be also sufficient to simply remove all *.css files from `public/assets/stylesheets` manually. This would save some compilation time.
-- Instead of using the online CSS validation service of ???, it would be nice to have a local CSS validator. Is there anything like this? TotalValidator seems to be able to do something like this, but it's not free for CSS validation and I don't know how to use it.
-- HTML and CSS sources should not be compressed, to allow more concise error messages
+- HTML and CSS sources should not be uglified, to allow more concise error messages
- Would be really useful to have the concrete URL of every validated HTML page. But can't find a way to extract it from Rack response.
- There are not tests yet. I first want to see whether this gem would be appreciated by the community, and if so, I will definitely add tests.
- Didn't try this with AJAX requests yet. Would be great if such responses would be validated, too!
+- In feature tests, the same views are getting rendered again and again. These same sources shouldn't be validated over and over again!
+- More configuration options needed! CSS1, CSS2, CSS2.1, CSS3! XHTML, HTML5, etc.
+- Better output needed! With context lines, etc.
## Disclaimer
-Headhunter is heavily inspired by Aanand Prasad's (outdated) [Deadweight](https://github.com/aanand/deadweight) gem and by Unboxed Consulting's [be_valid_asset](https://github.com/unboxed/be_valid_asset) gem. Thank you for your pioneering work!
+Headhunter is heavily inspired by Aanand Prasad's [Deadweight gem](https://github.com/aanand/deadweight), Eric Beland's [HTML Validation gem](https://github.com/ericbeland/html_validation) and Unboxed Consulting's [be\_valid\_asset gem](https://github.com/unboxed/be_valid_asset). Thank you for your pioneering work!
**USE THIS GEM AT YOUR OWN RISK!**
All provided functionality is provided "as is".