Stowaway will search through the source code of a web project and find all of the images, scripts and stylesheets that aren't being used. To use, simply provide the path to the directory you wish to search.
Please read the warning section at the end before using
Stowaway, by default, will search for the most common file types. Using the -t flag, you can tell stowaway to use custom file types.
sudo gem install stowaway
Stowaway assumes the path you provide is the root for your web application and will have no problem matching root-relative links to the actual files.
The example below will result in a positive match:
# path to file: /my_app/images/foo.jpg # image tag: <img src="/images/foo.jpg" />
Stowaway currently recognizes the following as valid references:
As a fall back, stowaway will match on file name. It will report the number of files that were matched by name only at the end of a run.
# basic usage stowaway path/to/site # from directory stowaway . # with file types stowaway -t .js .css path/to/site
Stowaway is useful for maintaining a tidy source tree, but it's not perfect. I probably don't need to say this, but a good VCS is mandatory. So before you start deleting files, make sure all your awesome changes have been committed and that you double-check stowaway's result against your own manual process.
This gem only works on ruby 1.9 ATM