Skip to content
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

Use versioned URLs for images #7932

Closed
jryans opened this issue Dec 20, 2018 · 5 comments
Closed

Use versioned URLs for images #7932

jryans opened this issue Dec 20, 2018 · 5 comments
Assignees
Labels
P2 T-Task Tasks for the team like planning

Comments

@jryans
Copy link
Collaborator

jryans commented Dec 20, 2018

We don't want to wait for caching to expire with quick changes.

@jryans
Copy link
Collaborator Author

jryans commented Dec 20, 2018

This will help @nadonomy iterate quickly on experimental, for example.

@jryans
Copy link
Collaborator Author

jryans commented Dec 20, 2018

The ideal case would be for the URL to contain the hash of the file, so that it only changes when the file changes. If that's too hard, then using the bundle ID similar to JS and CSS URLs is a good option as well.

@ara4n
Copy link
Member

ara4n commented Dec 20, 2018

see also
#233

@jryans jryans self-assigned this Dec 31, 2018
@lampholder lampholder added T-Task Tasks for the team like planning P2 labels Jan 2, 2019
@jryans
Copy link
Collaborator Author

jryans commented Jan 4, 2019

I have an approach that extends the Webpack build process to add a content hash to image URLs to achieve this.

However, it does require changing all JSX usages of images from:

<img src="img/warning.svg" />

to:

import WarningSVG from "img/warning.svg";
// ... other code ...
<img src={WarningSVG} />

Does anyone have opinions about this transformation? Feel free to add reactions here if you have them.

For cases where we use images via CSS urls, no change is needed.

@jryans
Copy link
Collaborator Author

jryans commented Jan 18, 2019

Fixed by matrix-org/matrix-react-sdk#2460 and #8159.

@jryans jryans closed this as completed Jan 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 T-Task Tasks for the team like planning
Projects
None yet
Development

No branches or pull requests

3 participants