asp.net-optimization

MVC4 bundling CSS failed Unexpected token, found '@import'

无人久伴 提交于 2019-11-26 19:55:49
问题 I'm trying to use bundling to combine & minify some CSS files. In my Global.aspx.cs Application_Start I have the following: var jsBundle = new Bundle("~/JSBundle", new JsMinify()); jsBundle.AddDirectory("~/Scripts/", "*.js", false); jsBundle.AddFile("~/Scripts/KendoUI/jquery.min.js"); jsBundle.AddFile("~/Scripts/KendoUI/kendo.web.min.js"); BundleTable.Bundles.Add(jsBundle); var cssBundle = new Bundle("~/CSSBundle", new CssMinify()); cssBundle.AddDirectory("~/Content/", "*.css", false);

ASP.NET MVC framework 4.5 CSS bundle does not work on the hosting

巧了我就是萌 提交于 2019-11-26 19:27:19
I am runing an App on app harbor written in MVC4. A bundle of css files doesn't work. In my local computer in debug mode I see the code of the App and I see the files. The App works as expected. <link href="/Content/css/home/basic-jquery-slider.css" rel="stylesheet"/> <link href="/Content/css/home/Home.css" rel="stylesheet"/> When I upload the app to Appharbor I see the bundle in the code but the App doesn't work. <link href="/Content/css/home?v=zhVOIpUNuvCOZhJyBcQWpMlozayor4te6k-pM29wHqI1" rel="stylesheet"/> When I browse that link in the href I get 403 - Forbidden: Access is denied. How to

Why is my CSS bundling not working with a bin deployed MVC4 app?

家住魔仙堡 提交于 2019-11-26 18:33:30
I have bin deployed an MVC4 application to my hosting provider, based on advice given here and one or two on-the-fly fixes, but the most immediately apparent problem is that the bundling for css doesn't work. When I replace the bundle ref with explicit file refs, my css works again. I am using a standard MVC4 RTM project template from VS2012. The provider is running IIS 7.5 and ASP.NET 4, and my previous MVC3 version of the same app worked fine. I am guessing I have grabbed a dependency somewhere of too low a version, and this might also contribute to my area based action link problem .

{version} wildcard in MVC4 Bundle

天大地大妈咪最大 提交于 2019-11-26 17:58:43
问题 In MVC 4 we have bundles. While defining the bundles we can use wildcards like * for all files in a folder. In the example below what does -{version} mean? public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js")); } 回答1: The -{version} basically maps to a version regex, or to be precise: (\d+(?:\.\d+){1,3}). Using * tends to grab too much, for example if you bundle jquery* , that will include

ASP.NET MVC4 Bundling with Twitter Bootstrap

偶尔善良 提交于 2019-11-26 15:26:08
问题 I'm trying to use the new bundling feature in MVC 4 with Twitter bootstrap and it seems to me like the paths to the glyphicons png-files int the css get's messed up in some way. Heres my code: bundles.Add(new StyleBundle("~/bundles/publiccss").Include( "~/Static/Css/bootstrap/bootstrap.css", "~/Static/Css/bootstrap/bootstrap-padding-top.css", "~/Static/Css/bootstrap/bootstrap-responsive.css", "~/Static/Css/bootstrap/docs.css")); bundles.Add(new ScriptBundle("~/bundles/publicjs").Include( "~

Why use @Scripts.Render(“~/bundles/jquery”)

独自空忆成欢 提交于 2019-11-26 15:01:04
问题 How does @Scripts.Render("~/bundles/jquery") differ from just referencing the script from html like this <script src="~/bundles/jquery.js" type="text/javascript"></script> Are there any performance gains? 回答1: Bundling is all about compressing several JavaScript or stylesheets files without any formatting (also referred as minified) into a single file for saving bandwith and number of requests to load a page. As example you could create your own bundle: bundles.Add(New ScriptBundle("~/bundles

How to force BundleCollection to flush cached script bundles in MVC4

℡╲_俬逩灬. 提交于 2019-11-26 12:37:12
问题 ... or how I learned to stop worrying and just write code against completely undocumented APIs from Microsoft . Is there any actual documentation of the official System.Web.Optimization release? \'cuz I sure can\'t find any, there\'s no XML docs, and all the blog posts refer to the RC API which is substantially different. Anyhoo.. I am writing some code to automatically resolve javascript dependencies and am creating bundles on the fly from those dependencies. Everything works great, except

How to add reference to System.Web.Optimization for MVC-3-converted-to-4 app

不羁的心 提交于 2019-11-26 12:34:51
I'm trying to use the new bundling feature in a project I recently converted from MVC 3 to MVC 4 beta. It requires a line of code in global.asax, BundleTable.Bundles.RegisterTemplateBundles(); , which requires using System.Web.Optimization; at the top. When I do this, I get the red squiggly lines that say, "Are you missing an assembly reference?" When I try and add reference, and click on the .NET tab in the dialog, sort from A-Z, I do not see System.Web.Optimization . How do I add this ref to my project? Thanks. The Microsoft.Web.Optimization package is now obsolete. With ASP.NET (MVC) 4 and

How can I specify an explicit ScriptBundle include order?

不打扰是莪最后的温柔 提交于 2019-11-26 12:08:35
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("~/Scripts/Shared/canvas.js"); bundles.Add(canvasScripts); } } and the following view: <script type="text

Why is my CSS bundling not working with a bin deployed MVC4 app?

雨燕双飞 提交于 2019-11-26 08:55:30
问题 I have bin deployed an MVC4 application to my hosting provider, based on advice given here and one or two on-the-fly fixes, but the most immediately apparent problem is that the bundling for css doesn\'t work. When I replace the bundle ref with explicit file refs, my css works again. I am using a standard MVC4 RTM project template from VS2012. The provider is running IIS 7.5 and ASP.NET 4, and my previous MVC3 version of the same app worked fine. I am guessing I have grabbed a dependency