brunocodutra / webapp-webpack-plugin

[DEPRECATED] use favicons-webpack-plugin instead
https://www.npmjs.com/package/webapp-webpack-plugin
MIT License
125 stars 17 forks source link

Add hash as query string #157

Open mpaluchowski opened 5 years ago

mpaluchowski commented 5 years ago

Can we have a way to add the content hash as query string for the generated files?

Right now I can set:

prefix: '[hash]/

which does the job, but creates lengthy and ugly URLs, that later make it difficult to review cache reports and similar, whereas if the hash was in a query string, it's often ignored or can be easily hidden in reports.

Ideally, I'd love the output to be similar to:

<link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png?791c3814a0650f9555ddd744b3e2fe77">
brunocodutra commented 5 years ago

That is not a bad idea, what about we add a suffix option, where the user could specify '?[hash] and default it to ''?

On the next major release I'd even be willing to change the default behavior such that suffix defaults to ?[hash].

brunocodutra commented 5 years ago

On a side note, you can also use [hash:8] (or whatever number) to truncate the hash, which might be useful even for the query string.

mpaluchowski commented 5 years ago

Yes, postfix sounds very good. Certainly more versatile than an explicit hash option.

And I din't know I could truncate the hash. Thanks!

brunocodutra commented 5 years ago

I've since realized suffix might be a better term, but yeah, great idea thanks!