README.rdoc in aanand-deadweight-0.0.3 vs README.rdoc in aanand-deadweight-0.1.0

- old
+ new

@@ -1,9 +1,13 @@ = deadweight Deadweight is RCov for CSS, kind of. Given a set of stylesheets and a set of URLs, it determines which selectors are actually used and reports which can be "safely" deleted. +=== Screencast! + +Ryan Bates has worked his magic once again. Head over here for an excellent introduction to deadweight: http://railscasts.com/episodes/180-finding-unused-css + === A Simple Example # lib/tasks/deadweight.rake require 'deadweight' @@ -14,21 +18,34 @@ dw.stylesheets = %w( /stylesheets/style.css ) dw.pages = %w( / /page/1 /about ) puts dw.run end -This will output all unused selectors, one per line. +This will output all unused rules, one per line. +Alternately, you can run it from the command-line: + + $ deadweight -s styles.css -s ie.css index.html about.html + +You can pipe in CSS rules from STDIN: + + $ cat styles.css | deadweight index.html + +And you can use it as an HTTP proxy: + + $ deadweight -l deadweight.log -s styles.css -w http://github.com/ -P + === How You Install It gem sources -a http://gems.github.com sudo gem install aanand-deadweight === Things to Note - By default, it looks at http://localhost:3000. - It's completely dumb about any classes, IDs or tags that are only added by your Javascript layer, but you can filter them out by setting +ignore_selectors+. - You can optionally tell it to use Mechanize, and set up more complicated targets for scraping by specifying them as Procs. +- There is experimental support for Lyndon (http://github.com/defunkt/lyndon) with -L === A More Complex Example, In Light of All That # lib/tasks/deadweight.rake