Skip to content
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

fix(@angular/build): fix tailwind css update on template hmr change #29115

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jmerro
Copy link

@jmerro jmerro commented Dec 11, 2024

When adding tailwind classes to a template, the builder notifies Vite with a ComponentUpdate which reloads the template on the client with the new classes. However, if the global styles.css from the build output was changed due to a new class being added there. The client won't be served that new styles.css- until a Full Update or rebuild occurs. This commit is primarily a workaround until better support can be added for this scenario.

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Newly added tailwind classes won't render their styles when ComponentUpdate sent, as the styles.css is not being checked for changes.

What is the new behavior?

On ComponentUpdate vite will also check the styles.css hash and if it is different send a css-update to the client to reload the global styles with the missing tailwind classes.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

When adding tailwind classes to a template, the builder notifies vite with a ComponentUpdate which reloads the template on the client with the new classes. However, if the global styles.css from the build output was changed due to a new class being added there. The client won't be served that new styles.css- until a Full Update or rebuild occurs.
This commit is primarily a workaround until better support can be added for this scenario.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant