bundling-and-minification

Reference bundles on requirejs

南笙酒味 提交于 2019-12-10 19:24:47
问题 I have an old web application that already uses bundling and minification of ASP.Net MVC. Now I'm starting to use requirejs and I have a problem! How can I reference bundle files from requirejs? I know that there is another similar question, but it does not answer to my question! How to reference the bundled js files (asp.net mvc4) in Require.js? 回答1: I'm hoping that I understand your question correctly. If your bundle contains requireJS modules and you're loading it on the page, you can

Asp.net MVC5 WebRole after deployed to Azure Cloud, breaks on @Scripts.Render

回眸只為那壹抹淺笑 提交于 2019-12-10 17:35:53
问题 I have a cloud service with an Asp.Net MVC 5 Web Role and Azure SDK 2.3 targeting 4.5.1 framework; The website works perfectly in Local. But when I deploy it to Azure Cloud service, I have the classic null reference error: Object reference not set to an instance of an object. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 9: @Scripts.Render("~/bundles/jquery") My BundleConfig.cs is simple: public static void

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

CSS & JS files not rendered when deploy of ASP.Net MVC application on IIS 8 (Windows 8)

微笑、不失礼 提交于 2019-12-10 16:02:38
问题 I'm having an issue when deploying my Asp.NET MVC 5 web application on a remote IIS 8 ! when i'm starting the server, the application works well, but no css or js file is working ! my local machine : my remote machine : my view when I click on view page source (in the browser) : <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Log in - My MVC Admin Template</title> <link href="/Test/Deploy/Content/Theme?v

ASP.NET MVC 4 - Add Bundle from Controller?

£可爱£侵袭症+ 提交于 2019-12-10 15:23:30
问题 I have some pages on my site that use certain CSS and JS resources - but they are the only page(s) to use that css or js file - so I don't want to include that CSS and JS reference in every page. Rather than modify each View to reference the CSS/JS it needs, I thought I could create a bundle in the Controller and add it to the Bundles that are already registered, and then it would be included in the bundle references, but this does not appear to be possible, or maybe I'm just going about it

How to remove comments with BundleTransformer YuiJsMinifier

一笑奈何 提交于 2019-12-10 14:44:32
问题 I am using BundleTransformer to minify css and js resources <yui> <css compressionType="Standard" removeComments="true" lineBreakPosition="-1" /> <js compressionType="Standard" obfuscateJavascript="true" preserveAllSemicolons="false" disableOptimizations="false" ignoreEval="false" severity="0" lineBreakPosition="-1" encoding="UTF8" threadCulture="en-us" /> </yui> As you can see for css it is possible to specify removeComments="true" But in js there is no such option. I red that YUI js

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

ASP.NET Bundling caching - where and how long?

六眼飞鱼酱① 提交于 2019-12-10 09:55:29
问题 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

Getting Styles.Render() to preserve indentation from Razor template?

倖福魔咒の 提交于 2019-12-10 05:53:11
问题 I'm slightly obsessive about the readability (and hence indentation) of all markup. When I call @Styles.Render("~/content/css") in an ASP.NET MVC4 project, only the first line maintains indentation from my Razor template. Here is the output: <link href="/Content/css/ie.css" rel="stylesheet"/> <link href="/Content/css/1140.css" rel="stylesheet"/> <link href="/Content/css/screen.css" rel="stylesheet"/> <link href="/Content/css/compatibility.css" rel="stylesheet"/> I would prefer all generated

MVC4 Bundling slow when using Scripts.Render

霸气de小男生 提交于 2019-12-10 03:14:47
问题 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