Closed ghost closed 4 years ago
Hey @TroyTae! Thanks for reporting this, but to be honest I didn't get what you mean by uglifying filename and BTW we're using hashes in filenames to deprecate caches on new builds. The other thing is that we want it to be super small and minimal. Please don't hesitate to reopen this issue if you think we definitely need this.
@arefaslani
Hello, thank you for reply.
I didn't write issue in detail. Sorry 😅
As you know, next-images
uses [name-hash]
pattern.
But I think generated file name is too long.
So I made uglify-set
, this module can reduce file name length:
poster1c7f86a319052c3df3795d6a637d0dd.png -> A.png
If we provide this option, people can reduce bundle size in production :)
@arefaslani Hmmm apart from the above comment, it seems this repo is configured that author cannot reopen issue
Sorry that was something I wasn't aware of that.
The problem with uglifying names to be like A.png
is that the chance that you be able to expire previous caches will reduce dramatically. The reason we're using hashes in filenames is that if you change the image in your app, then it'll change the hash and the browser understands to replace the new image with the old one. Else it'll still use the cached image.
@arefaslani
Isn't it nextjs control the caching of static files?
The files of public
directory maintain same name.
But if I change file, it reflects well.
The browser caches files based on the names and it's a good practice to generate filenames that reduce the chance of mistakes like this. Rails for example does the same thing for asset names.
@arefaslani Ah I see, I think it'll be fine because Etag is changed automatically. Anyway I understand what you mean. Thank you for explaining 👍
Hello thank you for your maintaining.
I wanna reduce filename in production.
So how about add
uglifyFileName
option?If you allow, I wanna send a PR using this library.