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

No way to load font when hashing filename #52

Closed
Ledzz opened this issue May 17, 2024 · 5 comments
Closed

No way to load font when hashing filename #52

Ledzz opened this issue May 17, 2024 · 5 comments

Comments

@Ledzz
Copy link
Contributor

Ledzz commented May 17, 2024

I'm using vite to build the application, and it's adding file hashes to filenames for cache busting. It's very common to do it for fonts, but I'm doing it anyway to always make sure I can update fonts asap.
It is impossible now to use fonts, because font png url is taken from font json definition.
I've already fixed it locally and would like to make a PR with changes.

@bbohlender
Copy link
Contributor

hmmm, thanks for the PR. I am not a fan of seperating json and png. I'd actually rather preferred it if the image was base64 encoded into the json. I know that this would require some build time tooling, but imo it would be the much cleaner solution with a better DX. What do you think?

@Ledzz
Copy link
Contributor Author

Ledzz commented May 17, 2024

Sounds reasonable. I'll try to do it on monday. I believe we still need some fix to make it work? I'll redo my PR.

@Ledzz Ledzz changed the title No way to load font and png separately No way to load font when hashing filename May 17, 2024
@bbohlender
Copy link
Contributor

if we use data urls it should not require any change, but you'd have to test it :)
https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs

if you come up with a process / tool to move the image into the json, it would be awesome if you could document that in the uikit docs :)

@Ledzz
Copy link
Contributor Author

Ledzz commented May 20, 2024

@bbohlender you're right, it works. I just thought that there will be some url composing logic that interferes using data urls. Made a PR with a sample script to do it: #56

@bbohlender
Copy link
Contributor

@Ledzz thanks for the PR, script looks very nice. Eventually, I want the font file generation to be integrated into the pmndrs/uikit CLI, where I would also inline the texture by default :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants