-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Live Preview: dispatch an event after DOM is updated #864
Comments
Hi, @bentouch-digital |
Hi @schabibi1, I don't have any screen recording but the idea is just to dispatch a JS event when the body is updated. document.addEventListener('storyblok-astro-live-preview-body-updated', () => {
// Here is the callback we could run code every time the body is updated via live preview
console.log('Live preview: body updated');
initUnoCssRuntime(); // With this line all our CSS is regenerated
}); |
A new event is introduced that triggers when changes are made in the Storyblok Visual Editor. This is particularly helpful for generating CSS dynamically, as outlined in issue #864.
🎉 This issue has been resolved in version 6.0.0-next.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
A new event is introduced that triggers when changes are made in the Storyblok Visual Editor. This is particularly helpful for generating CSS dynamically, as outlined in issue #864.
Description
Hi,
We use Astro with UnoCSS to generate our CSS. In preview mode, we use the plugin "unocss/runtime" which generate CSS class at runtime.
Live preview is a nice feature but if we modify a field which generate new CSS the CSS it not generated by UnoCSS because we can't detect when the body is updated. It would be nice if a JS event is dispatched as the Astro Navigation work. Astro navigation dispatch events when the page swap.
Suggested solution or improvement
Dispatch an event when the body is updated in file
/lib/live-preview/handleStoryblokMessage.ts
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: