public class BundleConfig { // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-{version}.js"));
I have just checked again and ... if I view the page source and click any of the bundle links, it shows me the source. However, in Chrome Dev tools, it shows all bundles as "404". The page is definitely not getting the CSS or JS files.
Oh, I thought "BundleTable.EnableOptimizations = true;" made it always bundle?! So, comment that out?
The weird thing is that the bundle link works if I go there directly - i.e. paste it into a browser, but it doesn't load for the actual page (gives a 404).
I am testing on Windows 7 & IIS - do I need to configure anything in IIS?
With debug set to true it outputs direct links to all individual files.
With debug set to false, I get the correct (looking!) bundle links but the links return 404 (as shown by dev tools in Chrome, IE, etc). However, if I "view source" and click on any of the bundle links, it shows me the bundled file content.
Visual Studio 2013 bundling not working
I have the latest Umbraco 7.2.1 in a Visual Studio project (2013, MVC) and it is working OK ... except that bundling does not seem to work!?
I added this:
public class RegisterEvents : ApplicationEventHandler { protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { BundleConfig.RegisterBundles(BundleTable.Bundles); // Ensure it bundles even in Debug mode BundleTable.EnableOptimizations = true; } }
Added the simplest bundle:
bundles.Add(new StyleBundle("~/bundles/css").Include("~/Content/Site.css"));
I get this in the HTML:
<link href="/bundles/css?v=z9DjkMY9q_jvoOnQewWj0aE-trF4D-_3T7bpoT8Wins1" rel="stylesheet"/>
But the link returns 404.
I know this isn't strictly Umbraco related, but ... any ideas?!
Can you post your entire code. The one of your BundleConfig class.
Dave
BundleConfig:
I have just checked again and ... if I view the page source and click any of the bundle links, it shows me the source. However, in Chrome Dev tools, it shows all bundles as "404". The page is definitely not getting the CSS or JS files.
Can you comment the line BundleTable.EnableOptimizations = true;
This will always minify and bundle your css and ignoring the web.config debug attribute.
Another option is to add your scripts / css line by line and see on which one it's failing. I had the bundling failing once on a syntax error.
Dave
Oh, I thought "BundleTable.EnableOptimizations = true;" made it always bundle?! So, comment that out?
The weird thing is that the bundle link works if I go there directly - i.e. paste it into a browser, but it doesn't load for the actual page (gives a 404).
I am testing on Windows 7 & IIS - do I need to configure anything in IIS?
Do you have this behavior in all browsers or only in Chrome ?
Dave
I have just checked it in IE v11 and it is the same.
With debug set to true, I get this:
Shouldn't it just output direct links to the css file(s)? Scrap that ... restarted IIS and it now does output the css link
Grrr, still won't work ... I think it's time to give up on bundling :-(
Does it work when you are running in debug mode ?
Dave
With debug set to true it outputs direct links to all individual files.
With debug set to false, I get the correct (looking!) bundle links but the links return 404 (as shown by dev tools in Chrome, IE, etc). However, if I "view source" and click on any of the bundle links, it shows me the bundled file content.
Suddenly remember something.
You need to update your web.config for this to work :
Dave
Yes, that worked!!! :-)
Thanks a zillion, Dave!
Awesome.
is working on a reply...