Determining which assets are not used in Rails?
1 answer
I found a few links but haven't tried them yet. I'll scold you when I get the chance to try them:
detect-unused-overtones
A script to help you find unused partial files . Well suited for large projects or projects under heavy refactoring. Haml and ERB covers.
deadweight
Deadweight is a CSS coverage tool. Given a set of style sheets and a set of URLs, it determines which selectors are actually used and the reports that can be "safely" removed.
Search production.log
There is a handy blog entry Deadweight Removal describing how to grep through the production log and script up to find and remove assets that have not been viewed .
The grep command they use:
grep -Eo ‘GET /(.*(.gif|.jpg|.jpeg|.png|.css|.js))[ \?]’ access.log > ~/assets.txt
+2
source to share