add-asset-html-webpack-plugin icon indicating copy to clipboard operation
add-asset-html-webpack-plugin copied to clipboard

use hash in filename?

Open Ginhing opened this issue 8 years ago • 10 comments

Thank you for your great job!

Could I use the hash in the output file name just like mydll.[hash].js ?

Ginhing avatar Apr 08 '17 14:04 Ginhing

Could I use the hash in the output file name just like mydll.[hash].js?

What do you mean? Do you have some example config of what you want?

Thank you for your great job!

You're welcome, hope it's useful!

SimenB avatar Apr 08 '17 18:04 SimenB

In current version there is a 'hash' option in it right? I set it true and built, the file I defined in 'filepath' was copied into the output path and was referenced in the html generated with a hash as a query string such as mydll.js?xxxxxxxxxxx.

Is there an option make the hash to be inserted into the filename instead of just query string?

Ginhing avatar Apr 09 '17 08:04 Ginhing

Ah, ok. That does not exist at the moment no. If you can figure out some API that's not too clunky, I'd be happy to merge a PR for it, though 😄

SimenB avatar Apr 09 '17 10:04 SimenB

It seems that addFileToAssets method of html-webpack-plugin has a limitation on producing a hash. Maybe we should work on there.

Ginhing avatar Apr 24 '17 01:04 Ginhing

Yes, that's a good point. We'd have to either do some work in html-webpack-plugin, or doe something smart in this method: https://github.com/SimenB/add-asset-html-webpack-plugin/blob/e0ebc4c/src/addAllAssetsToCompilation.js#L24-L29

SimenB avatar Apr 24 '17 05:04 SimenB

Hello. Is there any progress in the task? It will be useful for me.

nikolaas avatar Jun 26 '17 10:06 nikolaas

In my task, I need to use a hash of the compilation in the file name, so now I have to use html-webpack-include-assets-plugin and copy-webpack-plugin. But I saw that you want to merge your project with html-webpack-include-assets-plugin. I would be glad to use add-asset-html-webpack-plugin if it allowed to specify the hash of the compilation in the asset name.

nikolaas avatar Jun 26 '17 11:06 nikolaas

Hi, Do you do something with the task? It will be useful for me, too.

artbase avatar Oct 17 '17 09:10 artbase

I'd love to see a PR supporting this 🙂

SimenB avatar Oct 21 '17 09:10 SimenB

if there is a CDN pointing to source host, abcd.css?t=1234 will not be updated to new content. So we need abcd.1234.css

wuliupo avatar May 24 '19 15:05 wuliupo