I'm using Bundling in MVC and have the following:
@Scripts.Render("~/bundles/scripts.js");
When BundleTable.EnableOptimizations = true
this renders as:
<script src="/bundles/scripts.js?v=RF3ov56782q9Tc_sMO4vwTzfffl16c6bRblXuygjwWE1"></script>
When BundleTable.EnableOptimizations = false
this renders as:
<script src="/js/header.js"></script>
<script src="/js/content.js"></script>
<script src="/js/footer.js"></script>
Is it possible to intercept the non-optimized version to include my own custom cache buster?
For example:
<script src="/js/header.js?v=12345"></script>
<script src="/js/content.js?v=12345"></script>
<script src="/js/footer.js?v=12345"></script>
Why do you need to? In development, where BundleTable.EnableOptimizations = false
nothing is cached anyways, and in production you should have BundleTable.EnableOptimizations = true
also negating the need for something like this.
The short answer, is no, there's nothing built in to allow you to do what you ask, primarily because of the reasons I've already stated: there's simply no need for such a feature.
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