vite-plugin-handlebars
vite-plugin-handlebars copied to clipboard
Using with TailwindCSS - partials do not refresh when editting tailwind classes
reloadOnPartialChange: true,
added to vite.config.js
but it makes no difference.
Any solutions ?
I think the problem lies here:
https://github.com/alexlafroscia/vite-plugin-handlebars/blob/281c36a9b90435676b62a26d83b6a5eff3c811bf/src/index.ts#L47-L55
Specifically, returning []
skips any further processing, meaning that postcss (hence tailwind) isn't triggered at all.
I'm not sure how handleHotUpdate
should look exactly, but a workaround is to remove it entirely:
// TODO: remove once https://github.com/alexlafroscia/vite-plugin-handlebars/issues/192 is resolved
function handlebarsOverride(options) {
const plugin = handlebars(options);
// Currently handleHotUpdate skips further processing, which bypasses
// postcss and in turn tailwind doesn't pick up file changes
delete plugin.handleHotUpdate;
return plugin;
}
plugins: [
handlebarsOverride({ ... }),
],
didn't help when simple HTML partial changes
I think the problem lies here:
https://github.com/alexlafroscia/vite-plugin-handlebars/blob/281c36a9b90435676b62a26d83b6a5eff3c811bf/src/index.ts#L47-L55
Specifically, returning
[]
skips any further processing, meaning that postcss (hence tailwind) isn't triggered at all.I'm not sure how
handleHotUpdate
should look exactly, but a workaround is to remove it entirely:// TODO: remove once https://github.com/alexlafroscia/vite-plugin-handlebars/issues/192 is resolved function handlebarsOverride(options) { const plugin = handlebars(options); // Currently handleHotUpdate skips further processing, which bypasses // postcss and in turn tailwind doesn't pick up file changes delete plugin.handleHotUpdate; return plugin; }
plugins: [ handlebarsOverride({ ... }), ],