-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question on fingerprint file name for bundled images #40
Comments
I tested this out a bit more. Changing the image (keeping the same file name) does not change the directory fingerprint name. Is it possible to fingerprint by file size of images? If not, can we add a random suffix to the end of the directory name every time? |
Hi @leslc ! First thought on this matter is that the directory names (which are in actuality package ids) would be difficult to change on every pass. Especially in watch mode it is very convenient for them to be stable. Taking a step back, what particular issue are you running into because of the images maintaining their same name / path? Is it a caching issue? |
Hi @dgbeck, Thanks |
Hi @ferlores! Interesting. We have not run into this issue before but I can see why what you are suggesting could be helpful. If we were to go down this path, images urls / names would need to change in two places
However I'm hesitant to build this into cartero core since it seems very closely coupled to CDNs, and adds some significant complexity. Also of note, is that currently we are only adding shasums to bundle names, but if we start adding them to images, for consistency we should probably add them to individual css files, and potentially other (custom) asset types. Talking another a step back, which CDN are you using? Why can you not just invalidate / re-upload the images when you do a new deploy? |
Taking CDN out of the conversation for now, we'd need to fingerprint the image file names and/or directory for the exact same reasons fingerprinting is used for JS and CSS files -- utilize the browser cache if no image changes have occurred and always load an image that has changed. It would be best to change the fingerprint of the file name/directory only when the image changes. But it would be acceptable to change the name upon every build of images. It won't be the best for utilizing the browser cache, but it's better than the browser showing the old image from the cache. |
Thanks for pointing out the locations of the changes. We'll take a look and submit a PR. Would you be more comfortable with a configuration that controls the image file name/directory fingerprinting? (I personally think it should be the default to prevent browser and CDN cache issues). |
Ok. It will be an interesting exercise, if nothing else! My preference is to introduce an option, say Note that this will not be an easy PR. Couple considerations... It seems like we might want to bake some of this new logic directly into parcelify's Asset class. Right now we have a bit of an awkward line in cartero that changes the extension on all style assets to Also we will need to store the mapping of old asset names to new names somehow in the Where are you guys located? |
Hi @dgbeck |
Hi @ferlores , nice. We are in SOMA and yeah seems like it would be helpful to bounce around some ideas in person. I will email you. |
(edited after more research)
Hi @dgbeck,
I'm seeing an issue where a different image has the same fingerprint in the filename. How is the fingerprint figured out for images? Is it based on size? This might be an edge case where they are the exact same size but with different content.
Thanks
The text was updated successfully, but these errors were encountered: