Cannot use Links.xxxx constants in the new Web Optimization Bundles

Developer
Aug 22, 2012 at 3:52 AM
Edited Aug 22, 2012 at 3:52 AM

 

This code does not work:
bundles.Add(new StyleBundle("~/Content/css").Include(
                        Links.Content.example_css,
                        Links.Content.site_css));


Reason is that Links.Content.example_css resolves to "/content/example.css" and the StyleBundle is expecting "~/content/example.css".
This is of course controlled by the ProcessVirtualPath function which translates it to an absolute path.  Do not think we can change that because it will break too much other stuff.

What you think David?

Developer
Aug 22, 2012 at 3:55 AM

Additionally, we do not need all the code around 'IsProduction()' and such that returns minimized resources as the bundling now takes care of all that for us.  Just need a simple relative link to these resources...?

Dec 4, 2012 at 7:02 PM

Is there some way to programmatically disable the IsProduction() code? I'm not sure if it is T4MVC or something in the minified files themselves, but I get errors when I use String.Concat("~", Scripts.jquery_1_8_2_js) but no errors when I use "~/Scripts/jquery-1.8.2.js".

My jquery reference has a jquery.1.8.2.min.js.map file beneath it. I don't know if that means a particular tool generated it, which may be the cause for the error.

Developer
Dec 7, 2012 at 2:32 AM

You better double check everything....because that is just a constant string there!