-
-
Notifications
You must be signed in to change notification settings - Fork 362
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
feat: improve icon generator, use icon*.NODE_ENV.png #172
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting fallback strategy. This can be further improved to work for other assets as well!
Thanks! I'm also thinking this is a bit narrow and too explicit, for general assets management can be implemented some sort of pattern matching, but i'm not sure what exactly as of now.. |
@gitpash can you review and test out the new image generator? I did some fun caching as well as applying the environment variable into the name for both base icons, as well as developer-provided icons as well! |
/** | ||
* Fast hash for local file revving | ||
* DO NOT USE FOR SENSITIVE PURPOSES | ||
* md5 is good enough for file-revving: https://github.com/sindresorhus/rev-hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can even do crc32 for file diff if we want to squeeze out perf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think even google was struggling at implementing usable crc32 for their storage lol, they had to defer it to another module las time I checked xd
await Promise.all( | ||
[128, 48, 32, 16].map((width) => { | ||
// Cache the dev provided icon paths for each width | ||
if (iconState.devProvidedIcons[width] === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do we invalidate this cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just static path cache to avoid extra path resolution. We would invalidate it against the passed down assetDirectory, but that path doesn't change at runtime atm xD
Co-authored-by: Stefan Aleksic <soccerfanatic1996@gmail.com> Signed-off-by: L <6723574+louisgv@users.noreply.github.com>
It doesn't work for me, although it may be due to my local config, basically what I'm doing is running the fork of Plasmo and test in one of the examples directory.. when I log
|
oh oops... we set the environment variable at run-time, so the |
Details
Code of Conduct