Closed ajaybc closed 10 years ago
@ajaybc I've tried your using fork, and it is not working reliably for me. I have a task with 3 source files, and two destination files, and it is not reliably writing out the hashed version, even on a clean build.
As a design approach, might I suggest that it would be better to have an option to replace references using a pattern to optionally match the hash portion of the filename rather than a file-cache, that relies the exact last hash value.
I really hope for a solution to this, as without it, there's no clean way for my build to have granular watch tasks that saves me from (for example) rebuilding the Javascript files when my CSS changes, because I need to keep the previously hashed javascript file reference while updating the newly hashed CSS file.
I've finally opted for #29.
Thanks for your contribution!
When you hash an already hashed file, the file reference is not replaced in the dest. For eg. When I hash a file called 'style.css', it renames it to say 'style.h4543.css'. The reference in the dest file index.html will also get changed to the new name. But if I hash the file 'style.css' again after making some changes, the new hashed file name changes to 'style.foo123.css', but the reference in 'index.html' remains the same.
I fixed this issue by saving a mapping of the the original file names and their hashes in a file called filecache.json in json format and then using those references while hashing.