37 questions
0
votes
1
answer
507
views
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).
<script src="https://unpkg.com/vue2-...
5
votes
0
answers
3k
views
ScriptBundle says Object reference not set to an instance of an object
In the Asp.Net MVC BundleConfig if i use ScriptBundle it shows below error for this code:
Code:
bundles.Add(new ScriptBundle("~/node/GobiJs").Include(
"~/node_modules/...../test.js"
...
1
vote
1
answer
50
views
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.
...
1
vote
2
answers
2k
views
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 ...
3
votes
2
answers
3k
views
Why do my script bundles load with every page view in ASP.Net MVC?
I'm a little confused. I have my _layout.cshtml page below and it has a bunch of bundles containing .css and .js files. When I first load the site it runs through each file in the bundles. Fine, OK, ...
0
votes
1
answer
508
views
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/...
0
votes
1
answer
986
views
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 ...
2
votes
1
answer
847
views
C# MVC StyleBundle and ScriptBundle do not render correct paths if project is run in subdirectory
I have this code in BundleConfig.cs which simply includes a script
bundles.Add(new ScriptBundle("~/bundles/ui-scripts").Include(
"~/Scripts/ui-scripts.js"));
On my locale ...
0
votes
0
answers
79
views
Getting 404 for ScriptBundle on remote IIS 7.5 server and localhost
I've configured bundles in ASP.NET BundleConfig.cs file.
ScriptBundle thirdPartyScripts = new ScriptBundle("~/bundles/js");
thirdPartyScripts.Include(
"~/js/flowtype.js",
"~/js/moment.js"...
-2
votes
1
answer
1k
views
How to render Views or Partial Views of scripts at the bottom in _Layout.cshtml?
I have a problem in rendering few of my partial view’s script tags should render at the bottom in _Layout.cshtml page.
1
vote
1
answer
277
views
ScriptBundle - C# - add index in GET [closed]
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 ...
0
votes
0
answers
248
views
Preserve formatting and comments in Script Bundle
I have an api I built which is split into many files and have configured script bundles to build them into one. I want to provide two urls for the api to other teams in my company.
One Api will be ...
0
votes
1
answer
286
views
How to enable caching on a bundle accessed from an external site?
I'm trying to enable client js caching for a asp.net mvc bundle added to an external site. Currently the site references the js bundle by using url https://example.com/bundles/myscriptbundle.
...
1
vote
0
answers
635
views
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 ...
2
votes
1
answer
3k
views
ASP.NET MVC 5 bundled scripts not being called in _Layout.cshtml
Before I start let me say that I know there are other questions on SO about this issues that have great answers but please let me explain how mine is different.
I have an ASP.NET MVC 5 project where ...
1
vote
0
answers
2k
views
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(...
0
votes
1
answer
264
views
ScriptBundle and jQuery minification causes issues with addEventListener
I'm putting this up as a way to save people time.
I'm using jQuery 1.11.3, and MVC with ScriptBundle
On large pages I started getting errors calling addEventListener in ready.promise
Funnily ...
3
votes
2
answers
3k
views
is it possible to include Scripts and Styles in same Bundle ?(asp.net mvc5)
Attempting to use css and js files with same virtualpath bundle name
1 - is it possible ? (tried:but failed. cant define same virtual path name both for script and style)
2 - it it possible to ...
1
vote
1
answer
439
views
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 ...
3
votes
0
answers
500
views
StackOverflow in ScriptBundle .NET VS2013
We are experiencing a StackOverflow exception in VS2013 using:
var importedTypesBundle = new ScriptBundle("~/ImportedTypes/all.js");
Replacing with Bundle() it works... but it does not minify.
It ...
1
vote
5
answers
4k
views
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....
3
votes
1
answer
5k
views
MVC 4 Styles.Render & Scripts.Render Clarification
I'm using ASP.NET MVC 4 with Bootstrap and I've noticed that my project is a little bit different from a lot of articles and tutorials about "building your site with Bootstrap", they keep mention the ...
2
votes
1
answer
2k
views
ASP.NET MVC Bundling Subfolders structure
I want to include javascript files from whole folder and subfolders into a single ASP.NET Bundle. The purpose of this is to load all files from that folder at once.
The idea is to create an angular ...
5
votes
3
answers
721
views
asp.net scriptbundle multiple include vs single include
What is the difference in bundling:
bundles.Add(new ScriptBundle("~/bundles/jquery")
.Include("~/Scripts/jquery-{version}.js","file2.js", "file3.js"));
vs
bundles.Add(new ScriptBundle("~/...
1
vote
0
answers
318
views
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 ...
0
votes
1
answer
763
views
Manually utilize MVC script bundling
Is there a way to programmatically render a script bundle?
Using script bundles in MVC is great. Like it. Use it.
Now I'm writing an application that uses Self-Host WebApi in which I'd like to also ...
10
votes
1
answer
6k
views
Is there an easy way to render absolute URLs with Microsoft Web Optimization framework / script bundling?
I'm trying to render a JavaScript bundle using Microsoft's Web Optimization framework, like this:
@Scripts.Render("~/assets/bundle.js")
And building a small bundle, like this:
public static void ...
0
votes
1
answer
395
views
ASP.NET MVC ScriptBundle adding jquery 2.0.2 even though 2.0.3 is specified
When I run my application locally, the javascript references work as expected, but when I deploy it to our dev servers, it adds jquery 2.0.2 reference right before the 2.0.3 reference.
Why is it ...
15
votes
3
answers
10k
views
How is {version} value being populated in BundleConfig file?
I recently added jquery.dataTables nuget package to my project and I wanted to bundle the necessary files inside the BundleConfig. Since this package is installed inside a "DataTables-1.9.4" folder ...
1
vote
2
answers
317
views
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*",
...
0
votes
1
answer
397
views
Custom Binding triggers error with Script Bundle in Production
I have the following KnockoutJS custom binding:
ko.bindingHandlers.dtp = {
init: function (element, valueAccessor, allBindingsAccessor) {
//initialise datetimepicker with some optional ...
2
votes
0
answers
114
views
MVC4 Why have separate script bundles
This is just for interest sake.
Why does the vanilla MVC template in VS split the script bundles into
ScriptBundle("~/bundles/jquery")
and
("~/bundles/jqueryval")
I realize that most pages won't ...
9
votes
1
answer
11k
views
ASP.NET MVC Script bundle not rendered
I've included the following line in the BundleConfig.cs file:
bundles.Add(new ScriptBundle("~/bundles/jqueryajax").Include(
"~/Scripts/jquery.unobtrusive-ajax.min.js"));
However when I try to ...
4
votes
2
answers
2k
views
ScriptBundle with additional attributes
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
...
1
vote
1
answer
975
views
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 ...
1
vote
1
answer
2k
views
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 ...
3
votes
1
answer
5k
views
MVC 4: Force ScriptBundle to return non-optimized links of Javascriptfiles
We are trying to get the ScriptBundle in MVC 4 to return the expanded list of javascript when debug = false in the web.config. By default the ScriptBundle will optimize the javascript into one call ...