Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

When you hash an already hashed file, the file reference is not replaced in the dest #26

Closed
wants to merge 4 commits into from

Conversation

ajaybc
Copy link

@ajaybc ajaybc commented Jan 17, 2014

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.

@jrduncans
Copy link

@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.

@Luismahou
Copy link
Owner

I've finally opted for #29.

Thanks for your contribution!

@Luismahou Luismahou closed this Jan 23, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants