File hashes for cache-busting using the CLI
File hashes for cache-busting using the CLI
I recently started a new project that requires very little JS, so I'm not using any bundler like webpack or vite. So I thought this would be the perfect time to start using the standalone CLI. It worked great, but after a while I realized... what about cache busting?
I didn't find it mentioned anywhere in the docs o searching around, so I wonder if I'm missing something here. But how would you go about distributing assets generated by the CLI? All examples I see use a static name like main.css
, but as soon as the contents change, that could result in some bad UX for returning visitors.
I was thinking that maybe it would be nice to support a syntax such as this (similar to how it is done in webpack):
npx tailwindcss -i ./src/input.css -o ./dist/output.[hash].css
Even if that works, it's still necessary to manually change the name in the html file. Maybe it would make sense to generate a file similar to the mix-manifest from laravel mix, or copying an index.html
from a template (similar to what bundlers do).
But maybe I'm just overthinking this and there is an easier way, maybe using some existing tools. Any thoughts?
标签分类
产品发布