3 ms·
Expiry headers can just as easily be setup in your apache config and I can't think of any modern language that can't access file modification times. A simple c
by charlesmarshall 17y ago
Expiry headers can just as easily be setup in your apache config and I can't think of any modern language that can't access file modification times.
A simple config for multiple resource domains is nice; but I'm not a fan of helper functions. javascript_include_tag just isnt as clear as <script src="/location/of/file"></script>
- wycats 17y agoYou have to set up the Expires header and modify every asset tag to include a cache-busting query string. Doing this via HTML parsing in Apache is extremely non-performant. Manually adding the mtime query string to every asset reference is possible but tedious and yet another thing to think about while building your app (resulting in a very-close-to-0 use of the technique outside of explicit framework support).
- charlesmarshall 17y agoYes, both are very tedious, but both possible and done by other frameworks.
- wycats 17y agoThe lack of tediousness is the feature. When using Rails, you aren't required to know much about what's going on in order to get the benefits. And that results in an almost universal level of usage.
- wycats 17y agoAlso, the reason for using javascript_include_tag instead of <script> is that the actual script tag would look like <script src="http://assetsN.yourapp.com/location/of/concatted_js_files.js?mtimestamp></script> http://assetsN.yourapp.com/location/of/concatted_js_files.js...; There's a lot of additional help that a framework can offer for the client-side if you use its helpers, and that help can be tuned over time as the best practices themselves get refined.
- charlesmarshall 17y agoSpeaking of which; when advising to use multiple domains should really mention not to go overboard on the number you use. Too many alternative domains and you will get a new warning from yslow. Every time you pull from a new domain, this will incur a dns lookup, might even end up with the page going slower because them.
- wycats 17y agoYep. If you just use the default asset host configuration, we limit it to four hosts, as per YSlow.