Questions tagged [scriptbundle]

Bundling is a new feature in ASP.NET 4.5 that makes it easy to combine or bundle multiple files into a single file. You can create CSS, JavaScript and other bundles. Fewer files means fewer HTTP requests and that can improve first page load performance.

Bundling is a new feature in ASP.NET 4.5 that makes it easy to combine or bundle multiple files into a single file. You can create CSS, JavaScript and other bundles. Fewer files means fewer HTTP requests and that can improve first page load performance.

38 questions
1
vote
1 answer

Problem with "~" in routing file instead of ".."

I'm working on a asp.net web-form website in which I use ../ for routing files like js files, styles, etc. When I decided to apply ScriptBundle and replace ~/ instead ../ the website didn't work at. js file completely are loaded on browser but they…
Sasan
  • 644
  • 9
  • 29
1
vote
2 answers

ASP.net MVC bundles https

asp.net mvc bundles do not render for https. here is my code: bundles.Add(new StyleBundle("~/Content/css/css").Include("~/Content/css/custom.css")); View @Styles.Render("~/Content/css/css") And the error code I get is: Mixed Content: The page at…
June
  • 51
  • 6
1
vote
1 answer

ScriptBundle - C# - add index in GET

how can I add GET to script in ScriptBundle ? example: bundles.Add(new ScriptBundle("~/bundles/baseJs").Include( "~/Scripts/index.js" )); and I want to call this script: "~/Scripts/index.js?1" how can I do…
heyo
  • 19
  • 2
1
vote
0 answers

MVC bundles using CdnFallbackExpression produce a version-less bundle

When using bundle fallbacks in MVC, I notice that when the cdn fails, the fallback bundle does not have a version string attached to it. Is there a way to force the version string to appear? My concern is that if I move to a newer version of jQuery…
hobwell
  • 538
  • 1
  • 8
  • 26
1
vote
0 answers

How to create a ScriptBundle from dynamically generated content

I have a big Javascript file generated dynamically from a method in a Controller. public ActionResult GetEditingContext() { string json = JsonConvert.SerializeObject(...); return JavaScript(json); } The javascript is almost always the…
Stephane Mathis
  • 6,542
  • 6
  • 43
  • 69
1
vote
1 answer

What happens to ScriptBundle and StyleBundle in Asp.NET 5.0 vNEXT

In vNEXT, what happens to the bundling support via ScriptBundle and StyleBundle? My understanding is that bower, grunt & co. will completely replace that mechanism? Are there examples on how to do that? What I've found is a nice intro by Scott Allen…
John
  • 3,591
  • 8
  • 44
  • 72
1
vote
5 answers

Can I use Razor syntax inside Javascript included in a ScriptBundle?

I have a control that features code similar to the following: Javascript $("#Postcode").autocomplete({ source: '@(Url.Action("AutocompleteHelper"))' }); HTML @Html.EditorFor(model => model.Postcode) It used to all sit directly inside a .cshtml…
1
vote
0 answers

IBundleTransform implementation that runs on every request

I'd like to implement a custom IBundleTransform that is executed for every request. This would allow it to send user-specific CSS to each user. However, it seems that even if I set the UseServerCache property to false, the transform only runs on the…
pattermeister
  • 3,132
  • 2
  • 25
  • 27
1
vote
2 answers

How to host asp.net mvc4 jqueryval on cdn?

As Asp.Net MVC4 supports script bundling, it is very convenient to use something like bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( "~/Scripts/jquery.unobtrusive*", "~/Scripts/jquery.validate*")); However,…
Klotin
  • 165
  • 1
  • 12
1
vote
1 answer

JavaScript Error in Production but not Dev/Test (Bundling doesn't handle Linux style line endings)

I have a website running on MVC4 using the following javascript libraries. jQuery, jQueryValidate, Bootstrap, FineUploader, MaskedInput, Knockout and Modernizr. I also have my app specific javascript in there as well. They are all loaded using the…
1
vote
1 answer

Cannot bundle SignalR JavaScript using ScriptBundle class with optimizations

After installing the SignalR NuGet package: Install-Package Microsoft.AspNet.SignalR -pre I get the following files: jquery.signalR-1.0.0-rc2.js jquery.signalR-1.0.0-rc2.min.js I register the bundle: bundles.Add(new…
Carlos Nuñez
  • 470
  • 1
  • 3
  • 12
0
votes
0 answers

Adding jquery-3.* to an existing ScriptBundle causing script exceptions in MVC4

When I add "~/Scripts/jquery-3.*" to my existing bundle, it causes a series of script exceptions within the bundle, such as "Uncaught TypeError: n(...).parents(...).andSelf is not a function", "Uncaught TypeError: $(...).ajaxSuccess is not a…
Tom S
  • 127
  • 1
  • 4
  • 18
0
votes
1 answer

How to include vue dependency using CDN?

I have to include https://www.npmjs.com/package/vue2-daterange-picker in my project made with Kendo, Vue, .Net, Angular and jQuery(Yes it's a lot).
BeaST 30
  • 696
  • 1
  • 10
  • 22
0
votes
1 answer

Include Scripts from Feature folder in ScriptBundle

I'm trying to include js files that are not part of the original ~/Scripts folder included in a MVC web project. Rather I have my script files inside of my Feature folder like: ~/Features/MyNewFeature/Scripts However when running the app I get…
TMan
  • 4,044
  • 18
  • 63
  • 117
0
votes
1 answer

How to use script bundles in plain html (not cshtml)?

Before asking this question, I read the following two questions in Stack Overflow to avoid duplicate questions: 1) @Render.Scripts in plain .html file - not in .cshtml 2) Rendering the script bundle in a plain HTML page May I know how to use script…