asp.net-optimization

How can I specify an explicit ScriptBundle include order?

北城余情 提交于 2019-12-17 02:28:23
问题 I'm trying out the MVC4 System.Web.Optimization 1.0 ScriptBundle feature. I have the following configuration: public class BundleConfig { public static void RegisterBundles(BundleCollection bundles) { // shared scripts Bundle canvasScripts = new ScriptBundle(BundlePaths.CanvasScripts) .Include("~/Scripts/modernizr-*") .Include("~/Scripts/json2.js") .Include("~/Scripts/columnizer.js") .Include("~/Scripts/jquery.ui.message.min.js") .Include("~/Scripts/Shared/achievements.js") .Include("~

ASP.NET Bundles how to disable minification

两盒软妹~` 提交于 2019-12-17 01:41:12
问题 I have debug="true" in both my web.config(s) , and I just don't want my bundles minified, but nothing I do seems to disable it. I've tried enableoptimisations=false , here is my code: //Javascript bundles.Add(new ScriptBundle("~/bundles/MainJS") .Include("~/Scripts/regular/lib/mvc/jquery.validate.unobtrusive.js*") .Include("~/Scripts/regular/lib/mvc/jquery.validate*") .Include("~/Scripts/regular/lib/bootstrap.js") .IncludeDirectory("~/Scripts/regular/modules", "*.js", true) .IncludeDirectory(

MVC4 StyleBundle not resolving images

六月ゝ 毕业季﹏ 提交于 2019-12-16 22:36:52
问题 My question is similar to this: ASP.NET MVC 4 Minification & Background Images Except that I want to stick with MVC's own bundling if I can. I'm having a brain crash trying to figure out what the correct pattern is for specifying style bundles such that standalone css and image sets such as jQuery UI work. I have a typical MVC site structure with /Content/css/ which contains my base CSS such as styles.css . Within that css folder I also have subfolders such as /jquery-ui which contains its

Script Bundling in WebForms with Virtual Directories

天涯浪子 提交于 2019-12-14 03:57:14
问题 We have a separate "Framework" project for shared controls, javascript, etc. that is used by this and other projects. The Framework project is included in our solution, and we made a virtual directory for it with IIS so we can still make relative links to files with ~/Framework . So, we want to begin using the new Web Optimization bundles for scripts and styles. Everything is working fine, but we are having issues when attempting to use bundling with JS files in the virtual directory. When

Add additional ordered bundles to a DynamicFolderBundle?

吃可爱长大的小学妹 提交于 2019-12-13 18:39:47
问题 I have a DynamicFoldewrBundle : bundles.Add(new DynamicFolderBundle("userScripts", "*.js", true, new JsMinify())); So If I run : http://optimization.localtest.me/files/templates/designs/HelloTreble/ userScripts ...It will render all Javascript files bundled and minified in the HelloTreble folder. OK. Question : But how can I add custom ordered bundles to DynamicFolderBundle ? I have tried this : bundles.Add(new DynamicFolderBundle("userScripts", "*.js",new JsMinify()) .Include("~/Scripts/A.js

Microsoft bundles return 404 occasionally on deployment or in development

泄露秘密 提交于 2019-12-13 06:49:17
问题 I have a really weird situation, for months now, and not being able to find a solution. In a .net application using mvc bundles, i create a new bundle in every request, containing the scripts and styles needed for this request. This is working just fine most of the time. The problem is that sometimes during development and more often during a clean deployment, the bundle requests return 404. When this bug occurs (can't reproduce it) i try the following: IISReset and then refresh - still 404!

Microsoft ASP.NET Web Optimization Framework 1.0.0 debug mode error

吃可爱长大的小学妹 提交于 2019-12-10 16:29:40
问题 I have two questions, one about a bug and one about cdn QUESTION 1: (BUG) I have just added the new NuGet package: Microsoft ASP.NET Web Optimization Framework 1.0.0. I'm using ASP.NET MVC 3, and everything seems to be working except for one major bug. If I use debug="true" in web.config, then no script tags ever get outputted. I checked the view source and there are no tags for that bundle at all. If I set debug="false" then I get the script tag that points to my minification file. * Is this

Produce a “type” attribute in the “script” tag when using Scripts.Render in ASP.NET MVC 4

余生颓废 提交于 2019-12-10 14:09:13
问题 Is it possible to configure Scripts.Render in ASP.NET MVC 4 to produce a "type" attribute in the "script" tag? If so, how? Thanks in advance, Ryan 回答1: The 1.1-alpha1 update has support doing your own tag formatting with the Scripts/Styles helpers. There's a new DefaultTagFormat property which is by default set to: "<script src="{0}"></script>" There's also a RenderFormat method which takes in the tag format as well. You should be able to add the type attribute via either of these two

How to bundle specific CSS according to browser version?

我的未来我决定 提交于 2019-12-10 12:22:05
问题 I'm using MVC4 StyleBundle to bundle up a bunch of CSS. There is one CSS that's only needed for IE 9 or lower. In my BundleConfig class of RegisterBundles method, I have: if (HttpContext.Current.Request.Browser.Browser.Trim().ToUpperInvariant().Equals("IE") && HttpContext.Current.Request.Browser.MajorVersion <= 9) cssBundle.Include("~/Content/ie.css"); But then I got a Request is not available in this context error. Is it not possible to detect browsers during RegisterBundles method? 回答1: Yep

Minified script only in MVC4 BundleConfig

喜你入骨 提交于 2019-12-10 02:54:14
问题 I am adding the following ScriptBundle in BundleConfig: bundles.Add(new ScriptBundle("~/bundles/javascript").Include( "~/Scripts/jquery-1.*", "~/Scripts/load-image.min.js", "~/Scripts/bootstrap.*", "~/Scripts/bootstrap-image-gallery.*", "~/Scripts/my.global.js")); This is referenced at the end of my _Layout.cshtml as: @Scripts.Render("~/bundles/javascript") When debugging I notice that the output of this script rendering is: <script src="/Scripts/jquery-1.8.2.js"></script> <script src="