Using Asset Files
Our current tool setup uses the Propshaft gem to deliver general asset files to Rails. Propshaft will serve image, font, or other static asset files to your Rails code. For use of asset files in your JavaScript code, we can use esbuild.
Let’s talk about Propshaft first.
Propshaft’s goal in life is to allow you easy access to static asset files, allowing the browser to cache files, but still noticing when the files have changed. Toward that end, Propshaft “fingerprints” all the asset files, providing versions of the files with a filename containing a hash value. For example, as I look in the “Sources” tab of my browser tools, I see that the Rails server is sending files named application-a966e35708de2a027dcba6b1f4b26e1a20cb5c52.css ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access