Closed jamesarosen closed 14 years ago
Any JavaScript variables that are pulled from the Rails environment, and aren't actually static, should probably be placed in your "bootstrap" JS, along with other per-session JS variables, like account_id, etc.
Do you not use a bootstrap JavaScript in conjunction with your (truly) static assets? I tend to have one as an inline script at the top of the HTML page, generated by a .erb.js
partial...
Yeah... why do this in a separation action? Seems like you could even just have a erb/haml partial that you include in your layout file. On the other hand, if you have per-user variables and you want to cache your layout, you may want to do what jashkenas does.
I do have per-user and per-account JS variables. I guess I could just put the per-application stuff in there. It's not like it's a huge amount of extra bandwidth.
Great. That way your core JavaScripts can remain in the browser cache, even through server restarts, and asset_host
changes.
Jeremy: at first I read your last note as very sarcastic (users won't see the benefits of deploys). Now I realize you meant it genuinely: libraries shouldn't change across deploys, but my application code and settings certainly will.
Oops -- inflection is hard to communicate through github issues. No sarcasm intended...
I have a view that renders some application settings into Javascript:
Is there a way to tell Jammit to include the result of rendering this view in an asset package? If necessary, I could create a Rake task that would
curl http://localhost/assets/settings.js > public/javascripts/generated/settings.js
and use the latter in the asset package, but I can't think of a way to get Jammit to run the Rake task.