bundling-and-minification

ASP.NET Bundling caching - where and how long?

本小妞迷上赌 提交于 2019-12-05 23:59:16
While troubleshooting a performance issue in an ASP.NET app using the new bundling and minification features, and I noticed quite a bit of file activity accessing the javascript files used in the bundles. After a bit of testing on a clean MVC app, I noticed that after the first request, where I would expect it to read the files to build up the bundle, it didn't read the files on subsequent requests for about a minute or so. Then it would read them in again, and then go quiet for another minute or so. Obviously there's some kind of caching going on here, but where are the bundle contents

How to add bundles with dynamic content to asp.net web optimization

妖精的绣舞 提交于 2019-12-05 18:10:01
I'm using SignalR, which maps to asp.net application on virtual path "~/signalr". SignalR dynamically creates javascript proxy hubs on app start with virtual path "~/signalr/hubs". So the url "[http://myapp]/signalr/hubs" is where dynamic javascript content is. How can I add this virtual path to Asp.Net Web Optimization Bundling? Asp.Net Web Optimization Framework starting from 1.1 supports VirtuPathProvider's: ASP.NET bundling/minification: including dynamically generated Javascript Actually I don't understand how to use these VPP's. Could somebody explain in details or better give an example

Add multiple Bundles inside a single Bundle in C# MVC

随声附和 提交于 2019-12-05 14:54:07
For Example I Want to Create Bundles like this /*These are my Two separate Bundles*/ bundles.Add(new StyleBundle("~/Content/MYBundle1").Include( "~/Content/css/style.css")); bundles.Add(new StyleBundle("~/Content/MYBundle2").Include( "~/Content/css/media.css")); /*Now i want to use above two bundles as a single bundle */ bundles.Add(new StyleBundle("~/Content/AllPageBundles").Include( "~/Content/MYBundle1", "~/Content/MYBundle2") Also I want to ask that can i add reference of any file inside a bundle that is physically exist at any site server For Example:I want to add google fonts file inside

ASP.NET Bundling and Minification - Including Already Minified Files for Production Bundles and Unminified Files for Development

别来无恙 提交于 2019-12-05 13:15:37
问题 I want some expert advice on ASP.NET MVC Bundling and Minification. I have in my project script files that have both unminified (.js) and minified versions (.min.js). I have included them in my script bundle as follows: bundles.Add(new ScriptBundle("~/bundles/layout").Include( "~/Scripts/jquery-{version}.js", "~/Scripts/lib/errorhandling.js", "~/Scripts/lib/errorhandling.min.js", "~/Scripts/vendor/modernizr.custom.js", "~/Scripts/vendor/modernizr.custom.min.js", "~/Scripts/toastr.js", "~

Bundling less and css files together

青春壹個敷衍的年華 提交于 2019-12-05 11:25:54
I feel like bundling should be used to group a bunch of files which you use together into one single delivery to the browser. This would mean for example for my root style I would like to do something like the following: var bundle = new StyleBundle("~/Content/style").Include( "~/Content/mystyle.less", "~/Content/bootstrap.css", "~/Content/bootstrap-responsive.css"); bundle.Transforms.Add(new LessTransform()); bundle.Transforms.Add(new CssMinify()); bundles.Add(bundle); But this doesn't seem to work very well with the custom transform technique for bundling less files as it looks like it pre

ASP.NET Bundling - Ignoring second JS file

橙三吉。 提交于 2019-12-05 09:06:56
I have set up a simple test using ASP.NET's bundling and minification feature. I have two very simple js files: ~/JS/Site.js (function echo1() { alert("this is site.js"); })(); ~/JS/test.js (function echo2(value) { alert("and this is test.js"); })(); I've created a bundle as follows: bundles.Add(new ScriptBundle("~/bundles/scripts/site-globals").Include( "~/JS/Site.js", "~/JS/test.js")); and referenced the bundle on the page using @Scripts.Render("~/bundles/scripts/site-globals") When I run the site under debug ( <compilation debug="true" targetFramework="4.5" /> in web.config) I get the

Is there a way to update asp.net mvc bundle contents dynamically at run-time?

a 夏天 提交于 2019-12-05 03:55:15
I'm ASP.NET MVC v4 for my application, and I'm using the web optimization features (bundling and minification of scripts and styles). Now, what I understand is (please correct me if wrong), the optimization framework will look at the included files at the time of compilation and configure them. It'll create a version number (v=something) based on the contents. Every time the contents change, it'll recreate the version hash, and the client will get updated files. Now, is there a way to get the following done [1] Update something inside a js file in my server, and serve the updated one to the

MVC4 Bundling slow when using Scripts.Render

爷,独闯天下 提交于 2019-12-05 03:29:39
My asp.net MVC4 web project is running very slowly when serving a simple page that renders bundled scripts. However, when I use a 'hardcoded' script tag on the page with the source attribute of the virtual bundle path then performance is much better: @Scripts.Render("~/bundles/scripts") ~ 4 seconds vs <script src='@Scripts.Url("~/bundles/scripts")'></script> < 1 second My BundleConfig.cs has no special configuration, this is exactly as it appears: bundles.Add(new ScriptBundle("~/bundles/scripts").Include( "~/Scripts/jquery-1.7.2.min.js", "~/Scripts/jquery.validate.min.js", "~/Scripts/jquery

ASP.NET MVC bundles in Classic ASP (or PHP etc.)

萝らか妹 提交于 2019-12-05 00:11:34
问题 We have hybrid application that is still running part of the application with classic ASP along ASP.NET MVC. I would like to use bundled javascript and styles in classic ASP also. In ASP.NET we can nicely use bundled stuff with caching nicely, we are using Script.Render, which adds version hash to the fetch url. Thing is that this method of course isn't available in Classic ASP. We can use bundled directly from html <script src="bundles/js?v=<%=version%>"/> . version variable is classic ASP

ASP.NET MVC 4 app with bundling and minification, why is minification enabled in debug mode?

牧云@^-^@ 提交于 2019-12-04 22:35:57
I've just migrated an ASP.NET MVC 3 project to MVC 4 / .NET 4.0, and installed NuGet package Microsoft.AspNet.Web.Optimization in order to support bundling and minification of CSS and JavaScript. I've pretty much got bundling/minification working, the problem is it's always enabled. Even though the app is in debug mode, as configured in Web.config, all JavaScript includes are minified. As you can see from the below XML snippet, debug mode is enabled in Web.config: <system.web> <compilation debug="true" targetFramework="4.0"> ... </compilation> ... </system.web> An excerpt of my bundle