1

I'm using BundleTransformer to combine and optimize our projects JavaScript, LESS and CSS files.

In other projects and libraries usually append a hash of the combined files to the URL the asset is embedded in the HTML code to force the browser to download the new version of the file as soon as one of the source files has changed.

I have been looking for a similar solution for the BundleTransformer package but haven't found anything about versioning (also tried it with cache busting, etc.).

As this package currently has over 100k downloads I'm wondering how others solved this problem? Is there really no built-in way to append some kind of versioning suffix to the asset URL?

I also stumbled upon this solution by manually adding the build version to all of our assets - still I am wondering if there is a more elegant solution to this problem? (also this method is quite likely to force the browser to re-download files that have not been changed, for instance libraries like jQuery)

Community
  • 1
  • 1
rponudic
  • 155
  • 6

1 Answers1

2

Most likely, your web application is running in debug mode.

Try to switch it in release mode by editing the Web.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    …
    <system.web>
        <compilation debug="false" … />
    </system.web>
    …
</configuration>

Or add to the /App_Start/BundleConfig.cs file the following line:

BundleTable.EnableOptimizations = true;
Andrey Taritsyn
  • 1,286
  • 11
  • 26