0

I am using SquishIt for bundling and minification of css and js files in a asp.net mvc2 application.

I have used AddRemote method to download the jquery-1.7.1.min.js and jquery-ui-1.8.17.min.js from CDN in the release mode, but still I am seeing that the files are downloaded from the local copy instead from the CDN in release mode.

Code:

public static MvcHtmlString PackageLibs(this HtmlHelper htmlHelper)

    {

      var client = Bundle.JavaScript()

#if DEBUG

        .Add("~/scripts/jquery-1.7.1.js")

        .Add("~/scripts/jquery-ui-1.8.17.js")

#else

.AddRemote("~/scripts/jquery-1.7.1.min.js",

                    "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js",true)

        .AddRemote("~/scripts/jquery-ui-1.8.17.min.js",

                    "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.min.js",true)

#endif

.ForceDebug()

        .Render("~/scripts/combined.js");



      return new MvcHtmlString(client);

    }

Screenshot:

enter image description here

enter image description here

Can anyone help me to know what is creating the issue?

santosh kumar patro
  • 7,231
  • 22
  • 71
  • 143
  • Are you sure you have set `` in your `web.config`? – tpeczek Aug 26 '14 at 14:49
  • Yes I checked it and found the compilation debug mode is set to false and still the jquery-1.7.1.min.js and jquery-ui-1.8.17.min.js are loaded from the local system instead of CDN. – santosh kumar patro Aug 26 '14 at 14:53
  • After going through the article : http://wildermuth.com/2012/2/20/Modern_Web_Development_-_Part_6, I came to know that .ForceDebug method is causing the issue. If I update it to ForceRelease the it works for me. But still I have query regarding the AddRemote method. The method syntax shows that if I set the last parameter : downloadRemote to true as : .AddRemote("~/scripts/jquery-1.7.1.min.js", "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js",true) then it is not working for me. – santosh kumar patro Aug 27 '14 at 08:26
  • "downloadRemote" means "download the content over HTTP and reference locally (for bundle inclusion). If you *want* to reference from the CDN then you should use the overload without the downloadRemote boolean parameter, or specify false. – AlexCuse Sep 15 '14 at 16:10

0 Answers0