When using Bundles with EnableOptimisations set to true, the output URL contains a hash to prevent the browser from loading the file from cache if it has changed.
@Scripts.Render("~/content/js/global")
Outputs:
<script src="/content/js/global?v=PqstRRGF8qsUsJfHu6NBBBp6eDxYBz1JCbHY6CQJVks3"></script>
However, some files in our application are specific to one page. We reference these directly:
@Scripts.Render("~/areas/areaname/content/js/page-name.js")
The output URL in this case does not have the hash and is therefore cached, causing problems when we release changes to these files.
We rather not change every reference individually or have to manually change the URLs every time we change the files.
How can I globally add a hash (or a version number) to all script and style URLs that are not bundles?