Experiment and Routine

Musings of a part-time hacker

Offline Docs the Easy Way

I will be taking a few flights in the coming weeks and I wanted to arrange to have access to the documentation for some of the tools and frameworks I have been using.

I searched around a bit and found a suggestion at the bottom of this thread that explained how to do this with a single shell command. Big win!

The relevant command was:

wget -rkp http://api.rubyonrails.org/

This command uses wget to recursively pull down the target site into a local directory. The options are:

  • -r => Download recursively
  • -k => Convert links to point to local versions
  • -p => Get all images, stylesheets, etc

For mac users, you can install wget using homebrew.

I used this to grab the following:

In the case of jQuery (and prior Rails versions) there have been efforts to create this sort of resource and make it publicly available. For jQuery, you can download a pretty snazy single page app version of the docs at jQAPI, although it will not work in Chrome due to Chrome’s rules regarding XHR requests over the file:// protocol.

In the end, I am happy to have a simple method to manage this on my own.