With ASP.NET 5, I am moving from ASP.NET MVC's bundling system to a Bower/Grunt workflow for my client-side package management and bundling/minification. I'm trying to figure out how to closely replicate the MVC bundling functionality.
With MVC bundling, I manually created all of my bundles and then call out to a helper method such as: @Styles.Render("~/bundles/styles/site")
. In development I get separate link element for each CSS file in the bundle and in production I get a single combined and minified CSS file.
I have successfully set up Grunt with Bower to pull down packages and copy them into the appropriate final destination, but there's no differentiation between development and production. What's the closest functionality to my existing MVC bundling workflow?
This article below explain a very nice way to have both (Bower and .NET Bundle Config) playing nicely together...
http://robertnoack.com/x86/2014/07/asp-net-mvc-using-bowergruntwiredep-to-inject-javascript-dependencies-into-bundleconfig-cs/
The key info, is to use a Grunt Task (wiredep) to target the BundleConfig.cs file so you could still use bower to manage your dependencies and still use BundleConfig to let .NET minify your stuff for you.
After a day of pain, I have got grunt basically behaving in the same manner as asp.net minification with debug & release builds.
I have put together a git repo so you can just pull all the relevant files and mod as required.
https://github.com/glaidler/grunt-equivalent-asp.net-minification
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With