UserFrosting
UserFrosting copied to clipboard
CDN resources in bundles
Currently CDN resources must be manually defined in the source, integrating this into the asset bundles system would;
- Facilitate easier adoption of CDNs
- Ability to create bundles that declare all their dependencies
- Permit the introduction of features like local fallbacks (much like is done with jQuery) in a simple fashion (like what I've been trying with Razor here https://github.com/Silic0nS0ldier/ASP.NET-Core-Resiliency-Kit)
- Allow the same custom attributes to be applied as the rest of the bundle.
There are some challenges to be dealt with however, namely around how we will handle external resources in the middle of a bundle. (split bundle up, or dynamically at external resources somehow?).
As neat as this could be, should also investigate just how much value this would add, as there would be introduced complexity. No point having features for features sake.
Since the current convention is /js
for local javascript bundles and /css
for CSS bundles, how about simply adding a /cdn
type?
I imagine it would simplify things to keep the CDNs separate from the local js bundles?
Just to follow up, I think it would be beneficial to have a dedicated place to put CDNs, but I think we should keep it as simplified as possible.
I've had some time to think about this, and its looking like this will require a major release for both the bundler and UserFrosting to get properly implemented, mainly around supporting fallbacks. I've got other priorities ahead of this, but I'm hoping to get to it eventually (keen to apply what I've picked up on my fallbacks project).
To prevent tracking major browers (Safari and Chromium) have started disabling cross-domain resource caching, taking away a use case for this issue.
https://www.stefanjudis.com/notes/say-goodbye-to-resource-caching-across-sites-and-domains/