PaulTondeur / grunt-cache-busting

Cache busting files and updating references
8 stars 13 forks source link

Can't overwrite old path #6

Closed scottydev closed 10 years ago

scottydev commented 10 years ago

Hi guys, thanks for the plugin. Trying to use it on our site likeso:

'cache-busting': { css: { replace: ['<%= config.themeroot %>/Layouts/default.ctp'], replacement: 'filename.min.css', file: '<%= config.webroot %>/css/filename.min.css' } }

So it works great the first grunt, updating the path in default.ctp to 'webroot/css/filename.min-MD5-HASH.css', but every subsequent grunt the filename never changes again, guessing because the process is looking for 'filename.min.css'

Is there a wildcard or other method I could use of changing the existing filename path?

scottydev commented 10 years ago

Nevermind. I see that this is meant for the live build process only. So you create a new, separate production-only branch and it has the new files. Sorry about that!

PaulTondeur commented 10 years ago

This cache busting task is meant to add cache busting to code that has just been build and is ready for deployment. It assumes to have a fresh source from the start. So replacing the path one time and then another time within the same file is not going to work. Maybe there are other plugins which are doing this, or maybe this plugin could be changed/configured to use with a matching regex.

scottydev commented 10 years ago

Gotcha, a co-worker explained to me how this would work. Thanks for the response and the task!