In MVC3 C# I'm trying the new System.Web.Optimization Bundles JSminify & CssMinify package (part of the .NET 4.5 framework).
I have one main Bundle. On one page in my website, I wish to include a single .js file only for that page. I would like to have it minified like the bundles, but it does not need to be bundled.
How can this be done?
I think you need to add another bundle to it.
For example:
Bundle myJSBundle = new Bundle("~/combined-scripts/custom/my-page",
typeof(JsMinify));
myJSBundle.AddFile("~/Scripts/Custom/MyPage.js");
Then in your page:
<script src="@Url.Content("~/combined-scripts/custom/my-page")"
type="text/javascript"></script>
Reference: - http://www.dotnetexpertguide.com/2011/12/bundling-and-minification-aspnet-mvc4.html
More readings:
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