system.web.optimization

C# Web.Optimization Bundles and HTML5 cache Manifest

我是研究僧i 提交于 2019-12-11 18:09:15
问题 I am using ASP.NET optimization package to minify and bundle the scripts, and CSS files. I am also developing a mobile UI for my ASP.NET application which uses a HTML5 cache manifest. The optimization package updates the version of the dynamic bundle URL when the files change and the application cache is recycled. I would like to be able to update my manifest version whenever this happens and include the dynamic URLs the optimization package provides in the manifest. How can I read the

Getting System.Web.Optimization to work in a razor view within a class library

好久不见. 提交于 2019-12-08 18:27:50
问题 I'm building a modular MVC4 app, where each module (=area) is a class library. Models and controllers compile into the .dll, the views get copied into the appropriate folder. At runtime, everything works fine. At design time there is one annoying problem left: When editing a razor view within a class library, Visual Studio doesn't recognize the System.Web.Optimization Namespace. The name "Styles" does not exist in the current context. The name "Scripts" does not exist in the current context.

BundleTransformer.Less inject variables depending on context/request

烈酒焚心 提交于 2019-12-03 22:23:00
问题 We would like the use the bundling mechanism of System.Web.Optimization in combination with the Less transformer. The problem is that the same application/server serves pages for different branded websites. So depending on the 'SiteContext' the same .less files are used but different values should be used by the .less variables. So we want the (re)use the same less files but with different variables depending on the context of the request. I tried a couple of different theories: In all 3

Can you pre-cache ASP.NET Bundles?

可紊 提交于 2019-12-03 03:01:06
Every time I deploy an MVC web application my server has to re-cache all js and css bundles. Because of this it can take several seconds for the first view to render after deploying. Is there a way to pre-cache bundles? After all, the files are static at compile time. Solution To fix we replaced the default memory cache with caching that persisted beyond the App Pool life. To do this we inherited from ScriptBundle and overrode CacheLookup() and UpdateCache() . /// <summary> /// override cache functionality in ScriptBundle to use /// persistent cache instead of HttpContext.Current.Cache /// <

BundleTransformer.Less inject variables depending on context/request

流过昼夜 提交于 2019-12-01 00:32:05
We would like the use the bundling mechanism of System.Web.Optimization in combination with the Less transformer. The problem is that the same application/server serves pages for different branded websites. So depending on the 'SiteContext' the same .less files are used but different values should be used by the .less variables. So we want the (re)use the same less files but with different variables depending on the context of the request. I tried a couple of different theories: In all 3 cases I setup different bundles depending on the SiteContext. 1 inject an @import directive with the themed

How to make bundles unminify and list individual files when using a cookieless static content server?

自作多情 提交于 2019-11-29 16:15:10
I have two VS projects, one for the main website and one for a "static content" website where all the css, js, images, and other static content will be stored and accessed via a cookieless domain. So I have a BundleConfig.cs in my static site that creates all the bundles: public class BundleConfig { public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new StyleBundle("~/bundles/styles").IncludeDirectory("~/app/styles", "*.css", true)); bundles.Add(new ScriptBundle("~/bundles/scripts").IncludeDirectory("~/app/src", "*.js", true)); } } And in the main site I have another

How do I add type=“text/javascript” to a script tag when using System.Web.Optimization

狂风中的少年 提交于 2019-11-29 06:52:30
I have the following bundles.Add(new ScriptBundle("~/bundles/scripts/common").Include( "~/Scripts/jquery.validationEngine.js", "~/Scripts/common.js")); Which generates <script src="/bundles/scripts/common?v=9O0Yi3fV_GWpGyJQ_QYURiOYy6SEmxUQtkUVN4GXo2U1"></script> When rendered with <asp:PlaceHolder ID="PlaceHolderJs" runat="server"> <%: Scripts.Render("~/bundles/scripts/common") %> </asp:PlaceHolder> Which is not valid HTML as its missing type="text/javascript". How do I make the BundleCollection output this element in the script tag? MikeSmithDev One way is to change how you render your

How do I get System.Web.Optimization bundles to work with custom folders in an IIS virtual directory?

落花浮王杯 提交于 2019-11-28 13:24:08
I have an asp.net mvc4. I have modules that are deployed as subdirectories within this application using IIS Virtual Directories and I need to reference files in these modules. These module dlls are registering bundles. But the bundles are not generating anything into the html page. From this post, is-it-possible-to-unit-test-bundleconfig-in-mvc4 , I see that internally the bundles are using Server.MapPath. So it seems like it should work. I hooked BundleTable.MapPathMethod and even called Server.MapPath myself which does correctly resolve to the right physical directory. But it still won't

How do I get System.Web.Optimization bundles to work with custom folders in an IIS virtual directory?

不羁岁月 提交于 2019-11-27 07:38:40
问题 I have an asp.net mvc4. I have modules that are deployed as subdirectories within this application using IIS Virtual Directories and I need to reference files in these modules. These module dlls are registering bundles. But the bundles are not generating anything into the html page. From this post, is-it-possible-to-unit-test-bundleconfig-in-mvc4 , I see that internally the bundles are using Server.MapPath. So it seems like it should work. I hooked BundleTable.MapPathMethod and even called