bundling-and-minification

How to remove JS logging calls in our prod build of our mvc3 web app?

不羁岁月 提交于 2019-12-08 07:28:54
问题 We've got a lot of calls to our logging methods (that just wrap console.log) all throughout our JS in our MVC3 web app and I'd like to remove them from the JavaScript when we build our test and production builds. Currently we're using the bundling and minification nuget package to bundle and minify our JS into one big minified file but I'd like to have it rip out the calls to the logging methods as well. We do have a mechanism in place that replaces the logging methods with empty functions so

MVC4 bundling: Minification failed because of css3-feature?

霸气de小男生 提交于 2019-12-07 08:27:21
问题 I want to use MVC4 bundling and minification, but I always get this error message as comment in my not minified css file: /* Minification failed. Returning unminified contents. (534,29): run-time error CSS1019: Unexpected token, found ' ' (534,29): run-time error CSS1019: Unexpected token, found ' ' (534,29): run-time error CSS1042: Expected function, found ' ' (534,29): run-time error CSS1062: Expected semicolon or closing curly-brace, found ' ' (535,26): run-time error CSS1019: Unexpected

ASP.NET Bundling - Ignoring second JS file

心不动则不痛 提交于 2019-12-07 05:17:37
问题 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

Bundling less and css files together

心不动则不痛 提交于 2019-12-07 04:53:24
问题 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

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

那年仲夏 提交于 2019-12-06 17:00:47
问题 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

Can i use Bundling [Bundle.Config] in .net 4 Asp.Net web Application

我们两清 提交于 2019-12-06 04:59:39
问题 I have my application in .Net framework 4.It is a Asp.Net Web Application.i need to use Bundle.Config in order to use Bundling feature. I have read many documents saying that, it is feature in .Net framework 4.5 and that to in Asp.Net MVC Application. I need to make a bundle for Scripts in aspx pages. Can i include Bundle.Config in my file so that Bundling works. 回答1: Yes, you can use bundling in ASP.net 4. Use Nuget Package Manager to install Microsoft ASP.Net Web Optimization Framework to

How to publish only bundled/minified scripts

拟墨画扇 提交于 2019-12-06 03:53:27
问题 I have a MVC4 project that is deployed to Azure. The bundling and minification works absolutely fine. All the script files are in a folder /js which are bundled to /scripts/js When I publish to Azure using msdeploy, I would like only the bundled/minified script files to be deployed. I don't want anyone getting access to my un-minified scripts by guessing the url. I understand MVC bundling happens at runtime hence it would require the unbundled files to create the bundles on the fly. This

What is the proper use of IItemTransform for correcting paths in CSS Bundling with ASP.NET Web Optimization and BundleTransformer?

安稳与你 提交于 2019-12-06 02:46:33
问题 I'm presently working on a project that uses the ASP.NET Web Optimization library (v 1.1.0-Beta1) in conjunction with the Bundle Transformer extension (v 1.7.3-Beta1 for core, 1.7.0-Beta1 for LESS) which is used to convert LESS into CSS. Based on web searches paths within CSS (and less) appear to be a common issue, in most cases it is recommended to manually modify the CSS and be done with it. However, due to differences between our development and production environment, and not owning the

ScriptBundle adding both full and minified file in debug mode

删除回忆录丶 提交于 2019-12-06 02:22:07
I have the following ScriptBundle defined in BundleConfig.cs- public class BundleConfig { public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/js/yepnope").Include( "~/Scripts/yepnope.{version}.js")); } } It isn't in fact the only bundle, but that is all in there that is pertinent to the question - the rest is just other bundle definitions. When in "debug" mode as set in the web.config- <compilation debug="true" targetFramework="4.5"> Both the full and minified versions of the script are sent to the browser- <script src="/Scripts/yepnope.1.5.4-min.js">

Manually bundle and minify JS from a controller action

和自甴很熟 提交于 2019-12-06 01:59:20
问题 I love Bundling and Minification in ASP.NET MVC 4.5 and use it a lot. However, one small problem is that our "plugins" are hosted on a cookieless domain, which is in a separate project in my Visual Studio solution. I'm looking for a solution that'll allow our main site to request a bundled and minified JS file containing any number of our plugins from the cookieless site. Something like: http://my.cookieless.domain/plugins.js?include=alpha&include=bravo,charlie So far, the best solution I can