1Maskhal
11/01/2025, 1:32 PMChris Todorov
11/01/2025, 5:26 PM1Maskhal
11/02/2025, 2:22 PMActiveStorage::VariantRecord.destroy_all does work by creating sidekiq jobs for each record that also removes related files and records etc. I tried to find a more efficient way but nothing seemed to work. This way also seems very safe for production so i guess it can be worth the wait.. Once you remove everything locally once, it is easy to remove again after a single page load as only a few records are created per page.
Then Rails.cache.clear and hard refresh helped remove some NS binding aborted network errors.
Optimizing variants
UPDATE: I decided to use webp instead - snippet at bottom
(previous png optimizaion code below)
This reduces png size to less than 1/4 and jpg just slightly (i guess default jpg q = 80). I'm not sure 256 colors and 65% quality is really enough here though. Not sure what makes sense 😛1Maskhal
11/02/2025, 2:24 PM1Maskhal
11/02/2025, 6:57 PMChris Todorov
11/03/2025, 8:43 PM