sma
sma

Reputation: 35

grunt-cache-breaker not renaming revved files

I'm using grunt-cache-breaker to add a md5 hash to my filename. When I run grunt, it runs like normal, no error messages. While the filename inside the markup has the added md5 hash, the actual file does not have the md5 hash.

Here's what the cache breaker task looks like in my Gruntfile.js

                  cachebreaker: {
                  dev: {
                      options: {
                          match: ['idm-ui-vendor.min.js'],
                          replacement: 'md5',
                          src: {
                              path: 'tmp/dev/common/scripts/idm-ui-vendor.min.js'
                          }
                      },
                      files: {
                          src: ['tmp/dev/login/views/view.jsp']
                      }
                  }
              }

Upvotes: 3

Views: 1417

Answers (2)

andistuder
andistuder

Reputation: 506

The grunt-cache-breaker library (version <= 2.0.1) does not support file renaming. It only updates references to files.

I'd suggest you use the grunt-cache-bust library instead.

Upvotes: 1

Zero Distraction
Zero Distraction

Reputation: 1356

I'd suggest you just remove the replacement md5 part, and go with the URL parameter which is default, and does not require to rename the file. Like so:

             cachebreaker: {
              dev: {
                  options: {
                      match: ['idm-ui-vendor.min.js'],
                      src: {
                          path: 'tmp/dev/common/scripts/idm-ui-vendor.min.js'
                      }
                  },
                  files: {
                      src: ['tmp/dev/login/views/view.jsp']
                  }
              }
          }

Upvotes: 0

Related Questions