When a CSS is called from a browser, Rails combined all CSS files into one:
all.css?random-section-id-number (e.g. all.css?2342568659756352)
Each time it expires, the number changes.
I am sharing this CSS file with WordPress, and I want WordPress to call the same CSS so that it reduces the HTTP request. But if I put all.css, it will call a fresh CSS from Rails, result in redownloading the CSS file.
What do I do to have WordPress to just used the cached CSS file with the same section-id?
The “random number” after assets in Rails is the file mtime. To do something similar in WordPress:
That said, the purpose of that string isn’t to help caching, but to act as a cache-buster when the file changes. Your browser will download a new copy of the CSS if you force-refresh, or you aren’t setting an expiry header on the CSS file properly, but without the cachebuster string, it wouldn’t know to download a new copy when the file changes.