How To Delete Unused Images From Rails Application.

 In a Rails application, superfluous images will influence application load time and furthermore delayed down your test and convey pipeline. 

One of my new ventures was to attempt to recognize the unused images and eliminate them securely. It was a significant troublesome undertaking in the rails application to discover images that were not being used. 


Actually, It's difficult to check in case you're not utilizing every single one of them, so you can utilize the underneath Rake errand to flush out all the unused images and delete them. 


So Here is a Rake assignment to discover unused images in the Rails venture to erasure. 


1) How to Create Rake task? 

Order: rails g task <namespace> <taskname> 

For Eg: rails g task image_cleaner find_unused_images 

rake document will produce inside the "lib/errands" organizer. 


Rake document body: 


How to execute? 

Run beneath rake task order in your undertaking catalog terminal: 


Execution result: 


Concerning me, I have effectively deleted unused images by utilizing the above rake task without breaking anything. ideally, presently you couldn't want anything more than to delete all the images in your application/resources/images organizer that you don't utilize.

Hope this helps!

Thanks for reading.

Comments

Popular posts from this blog

The Most Secure & Fast Digital Contract & E-Signature Solution for Modern Businesses

All-in-One Review Management Platform

What Is Agile Testing - Methodologies?