Closed Meligy closed 11 years ago
For CSS, this is difficult to control. You would have to use the api or config to filter out your global css. For javascript there is no "elegant" way but you can arrange your scipts in such a way to make RR think that they should be bundled separately. RR will only bundle contiguous scripts: scripts separated by nothing but whitespace or comments. So you could put some dummy, hidden markup in between the global and page specific scripts.
Hope that helps!
Aha. Thanks for the response. Actually, RR's killer feature to me is auto-sprites (I'm still playing with RR at early stage), so, was even thinking about turning it on only for CSS, but it's OK.
I tried to separate scripts with comments, didn't work as you explained. Makes sense. A hidden element shouldn't be "too" bad. Was kinda hoping for maybe an API that I can call in HTML page, and send the files I want, and it in runtime will generate something that RR dynamic response processor knows to not-re-process, but maybe this will come in bundles anyway.
Appreciate it.
So, normally I'd have global files like jQuery and libraries, and some code maybe required for shared areas of the site (header/footer/side-bar).
And then each page would have its own scripts and styles too.
If the global files are bundled separately, they'll be cached in every page and the page will only need to download the custom/page-specific parts (after first request of course).
With global files combined with the custom/page-specific files, all pages will download them again at least once.
In ASP.NET Optimization package, this is done via creating multiple bundles, I understand bundles may be a future feature for RR, but is there a current workaround? (other than disabling RR for all global assets)