Determining which assets are not used in Rails?

I use a resource pipeline in Rails and we have a lot of humle scores that are probably not being used, as well as unused images.

How do you work if the asset is not in use, for example. images, haml, etc.? Is there an automated way to find out?

+3


source to share


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







All Articles