bundling-and-minification

Is there any way to have a file extension in a bundle name?

折月煮酒 提交于 2019-12-03 10:33:49
I would like to have define a bundle like this: bundles.Add( new StyleBundle("~/style.css").Include( //... )); If the bundle name is just "~/style" this works, but with the file extension it always returns a 404. I suspect the server searches for CSS and JS files on the drive and ignores the bundling system, but I can't find anyone else who is trying to include file extensions in bundle names. Is this possible to do without something like a URL rewrite? Darin Dimitrov You could add the following to your <system.webServer> section in web.config: <modules runAllManagedModulesForAllRequests="true

cssmin not correctly handling @import

两盒软妹~` 提交于 2019-12-03 06:07:08
I am using cssmin on files containing @imports. cssmin is recursively importing local files correctly, but for imports that point to a URL the imports are left inline. This makes the resulting minified CSS invalid because @ rules must be at the beginning of the file. Does anyone know a good solution or workaround to this problem? Alex Carod I have exactly the same problem with cssmin and @import , and i found a solution with grunt concat : Create a concat grunt task that: Put @import url in the begining of mified css file and replaces references of @imports url for "". Execute task concat

Prevent bundle from responding if cache buster doesn't match content

杀马特。学长 韩版系。学妹 提交于 2019-12-03 06:06:00
I'm using Bundling and Minification across a server farm where there is a cross-over period of old and new servers. The issue I have is that the old servers are caching the content of the new bundle cache buster URL. For example the new HTML is cached with the new bundle URL: <script src="/bundle.css?v=RBgbF6A6cUEuJSPaiaHhywGqT7eH1aP8JvAYFgKh"></script> This then makes a request to an old server which hasn't yet been updated with the new CSS code and this then cached. Any subsequent calls to the new bundle URL will then return the old code. Therefore is there a way of checking that the content

Prepend CDN url to mvc 4 bundler output

五迷三道 提交于 2019-12-03 04:35:21
问题 Using the built in MVC4 bundler, how do I prepend my CDN url to the link tags it produces? I've setup Amazon Cloudfront so that it pulls assets from my webserver when first requested. So when I define a bundle like so: bundles.Add(new StyleBundle("~/Content/css").Include( "~/Content/reset.css", "~/Content/960_24_col.css", "~/Content/Site.css" )); When deployed, I can reference it thus: http://[cloundfrontid].cloudfront.net/Content/css?v=muhFMZ4thy_XV3dMI2kPt-8Rljm5PNW0tHeDkvenT0g1 Now I just

How to reference the bundled js files (asp.net mvc4) in Require.js?

不羁的心 提交于 2019-12-03 00:45:54
I have been studying John Papa's pluralsight course on SPA. In his main.js , he gave a name to each js library which is included in the bundle. (function () { var root = this; define3rdPartyModules(); function define3rdPartyModules() { // These are already loaded via bundles. // We define them and put them in the root object. define('jquery', [], function () { return root.jQuery; }); define('ko', [], function () { return root.ko; }); define('amplify', [], function () { return root.amplify; }); define('infuser', [], function () { return root.infuser; }); define('moment', [], function () {

How can I add the result of an ASP.NET MVC controller action to a Bundle?

风格不统一 提交于 2019-12-02 23:46:00
I have a controller action that returns Javascript file. I can reference this file from my view and it works fine. I'd like to put it in a System.Web.Optimization.Bundle with the other JS files. I'm trying to do this, essentially: new Bundle().Include("~/DynamicScript/UrlDictionary"); The other files in my Bundle get rendered just fine, but this one is ignored. Seeing this behavior, my assumption is that bundling gets handled before the application is able to resolve URLs through the routing infrastructure, or maybe that the bundling component doesn't request files in a manner that would allow

Prepend CDN url to mvc 4 bundler output

雨燕双飞 提交于 2019-12-02 17:20:42
Using the built in MVC4 bundler, how do I prepend my CDN url to the link tags it produces? I've setup Amazon Cloudfront so that it pulls assets from my webserver when first requested. So when I define a bundle like so: bundles.Add(new StyleBundle("~/Content/css").Include( "~/Content/reset.css", "~/Content/960_24_col.css", "~/Content/Site.css" )); When deployed, I can reference it thus: http://[cloundfrontid].cloudfront.net/Content/css?v=muhFMZ4thy_XV3dMI2kPt-8Rljm5PNW0tHeDkvenT0g1 Now I just need to change the links produced by the bundler from being relative to absolute links pointing to my

Declarative dynamic bundling/minification for MVC?

依然范特西╮ 提交于 2019-12-02 06:49:25
Is there a stock or pluggable way (like a NuGet package) to let me declare .js , .css , and ideally .less files in the MVC views and partials where I use them, and have them automatically runtime bundle and minify in production? (a.k.a. " Autobunding ") I've tried the built-in MVC 4 bundling. I dislike that bundles are defined far away from where a page author would expect to find them, in BundleConfig.cs . This is unworkable for non-C# team members. As an example of what I'm looking for , here's what I cobbled together myself using SquishIt . ExtendedViewPage.cs /// <summary> /// Caches a

Declarative dynamic bundling/minification for MVC?

梦想与她 提交于 2019-12-02 06:42:12
问题 Is there a stock or pluggable way (like a NuGet package) to let me declare .js , .css , and ideally .less files in the MVC views and partials where I use them, and have them automatically runtime bundle and minify in production? (a.k.a. "Autobunding") I've tried the built-in MVC 4 bundling. I dislike that bundles are defined far away from where a page author would expect to find them, in BundleConfig.cs . This is unworkable for non-C# team members. As an example of what I'm looking for , here

How can we enable caching for Bundles in MVC5

点点圈 提交于 2019-12-02 05:09:59
I have created 2 bundles in my mvc project as given below: public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/Scripts/BaseScripts").Include( "~/Content/js/jquery-{version}.js", "~/Content/js/jquery-ui-{version}.js", "~/Scripts/jquery.unobtrusive-ajax.min.js", "~/Content/js/bootstrap.js", "~/Content/js/bootstrap-datepicker.js", "~/Scripts/jquery.validate.min.js", "~/Scripts/jquery.validate.unobtrusive.js", "~/Scripts/customvalidation.js" ) ); bundles.Add(new ScriptBundle("~/Scripts/CustomScripts").Include( "~/Content/js/customscripts/commonscript.js",