Skip to content

Conversation

@gavmck
Copy link

@gavmck gavmck commented Nov 20, 2025

Fixes an issue where changes to CSS/SCSS files referenced by Stencil components via styleUrl were not triggering hot reloads in Storybook.

The solution adds a custom Vite plugin that:

  • Tracks which components depend on which style files
  • When a style file changes, touches the component file to update its mtime
  • Forces unplugin-stencil to recompile the component with updated styles
  • Triggers a full page reload to display the changes

This works for CSS, SCSS, SASS, and any other style file formats.

Fixes an issue where changes to CSS/SCSS files referenced by Stencil
components via styleUrl were not triggering hot reloads in Storybook.

The solution adds a custom Vite plugin that:
- Tracks which components depend on which style files
- When a style file changes, touches the component file to update its mtime
- Forces unplugin-stencil to recompile the component with updated styles
- Triggers a full page reload to display the changes

This works for CSS, SCSS, SASS, and any other style file formats.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant