I've created a bundle of various script files that I want to be combined/minified together. In my code behind file (yes, sorry it's in VB!) I add it to a <asp:placeholder />
on the <head>
like this
Me.PlhHeader.Controls.Add(New LiteralControl(Scripts.Render("~/bundles/main").ToHtmlString()))
This will work, but it always seems to output the compressed minified version, even when debug="true"
in the Web.Config.
no matter what, this is what is output: <script src="/bundles/main"></script>
What do I need to do differently to make this output the individual uncompressed files when in debug mode?
EDIT
I've also tried to manually set the option BundleTable.EnableOptimizations = false
and it still outputs the single minified script tag. I'm out of ideas.
I was doing something very dumb with some related code, but technically everything with the bundles was fine and working correctly. Problem solved for me!
To optimize the performance of an application I found that bundling and minification can significantly improve the performance. It can be applied on MVC as well as in ASP.NET web forms.
Both bundling and minification are the two separate techniques to reduce the load time. The bundling reduces the number of requests to the Server, while the minification reduces the size of the requested assets.
Click on wwwroot folder, select the css file you want minified, then right click and choose bundler & minifier. Then from popup minify file. It will be the same file name with the minified version.
Bundling and minification are two distinct performance optimizations you can apply in a web app. Used together, bundling and minification improve performance by reducing the number of server requests and reducing the size of the requested static assets.
I would recommend you to install the Microsoft.AspNet.WebOptimization.WebForms. It works really well.
Microsoft.AspNet.WebOptimization.WebForms
Then you can use:
<%: System.Web.Optimization.Scripts.Render("~/bundles/main") %>
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