Setting up Bundle.config with CDN source with a local fallback
Hi
I have followed the Paul Seal approach to this issue (https://codeshare.co.uk/blog/how-to-use-bundling-to-minify-css-and-javascript-in-mvc-and-umbraco/) but having issue's with it.
If I follow his Umbraco approach to just set up bundling with local files, this works fine but I am hoping to have my files served by CDN with a fallback if this fails.
At the bottom of his post, it looks like he reverts back to bundling with CDN in a typical MVC approach but this is carried out in the RegisterBundles methods. I have tried to implement this is the ApplicationStarting event but just doesn't work at all. It just loads the local file in release.
Anyone else had any issues with this type of thing?
Setting up Bundle.config with CDN source with a local fallback
Hi
I have followed the Paul Seal approach to this issue (https://codeshare.co.uk/blog/how-to-use-bundling-to-minify-css-and-javascript-in-mvc-and-umbraco/) but having issue's with it.
If I follow his Umbraco approach to just set up bundling with local files, this works fine but I am hoping to have my files served by CDN with a fallback if this fails.
At the bottom of his post, it looks like he reverts back to bundling with CDN in a typical MVC approach but this is carried out in the RegisterBundles methods. I have tried to implement this is the ApplicationStarting event but just doesn't work at all. It just loads the local file in release.
Anyone else had any issues with this type of thing?
Hi,
In that case you might need to use to make it work.
BundleTable.Bundles.UseCdn = true;
Please try. Hope it helps to solve the issue.
Cheers,
Shaishav
That's was a quick reply! Thanks!
Sorry to give some perspective, this is what I already have:
The switch works fine but the fallback doesn't. I'm not sure if I have to perform a separate check in the master template or if this is automated? I've spotted this on Microsoft Docs: https://docs.microsoft.com/en-us/aspnet/mvc/overview/performance/bundling-and-minification#code-try-6 but this makes me wonder why we include the local path in the script bundle?
I've cracked it. Just couldn't spot it. I had an 'add trailing slash' rule applied which was causing my fallback to fail.
I already had an negation for /umbraco so just added one for my bundles path and it worked.
is working on a reply...