Assets naming
Hi, thanks for your plugin.
When I build without your plugin, Bun rename my css and js files with an hash if I set the parameter naming: "[dir]/[name]-[hash].[ext]", but with your plugin names aren't changed.
Do you know how to do that ?
Thanks
Hey @gouz
Thank you for reporting this issue! To be honest it's because I didn't implement this. I could implement this for you, but I'd need to do some research to make sure I'm implementing this right. Do you have a specific use case in mind that I could make sure my implementation works properly for it?
Thanks for your quick response ;)
I'll prepare you a usecase quickly
Imagine you have the following index.html:
<!DOCTYPE html>
<html>
<head>
<link href="styles.css" rel="stylesheet" />
</head>
<body>
<h1>Test</h1>
</body>
</html>
If styles.csscontains h1 { color: red; }, the generated file will be renamed in a styles-SHA, and in the index.html the link will point to this file.
If the content change, a new sha is calculated, then no cache ;)
It works for css & js
@gouz
Sorry this is taking a while. I still have to figure out a few things about the implementation. Specifically how to treat chunks and assets with the naming rules. I want to ensure everything works properly. Just know I'm still working on this right now.
No problem. Thanks
great if it's ready, then i could switch from my packup version ( https://github.com/mindon/packup ) to bun with html plugin!
@mindon @gouz This has now been fixed as part of v2.1.0. Sorry for the long wait.
It requires that you upgrade to Bun v1.1.34, since it relies on #14717, which fixed Bun's bug #8280. I was waiting for this issue to be fixed before rewriting the code base, but nobody did, so I decided to submit a pr to fix it. Now that it has been merged, I was able to rewrite the code base to support naming, you can read more about it here.
Please let me know if you would like to see any other additional features as part of this, and thank you for being patient!
Thanks a lot, no problem for the wait, it's an opensource projet and you're not paid for.