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

feat(swc-plugin-angular): ✨ optional transform styleUrl and styleUrls #421

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

56789a1987
Copy link

This adds a new option importStyles to swc-plugin-angular, enabling replacing styleUrl and styleUrls with actual CSS file imports instead of empty styles: [].

Useful when generating code for browser such as Webpack/Vite dev server.

Disabled by default because some tests don't import CSS as strings by default, which can break Angular component creation.

Closes #410.

This adds replacing `styleUrls` with actual style imports instead of empty `styles: []`.
Useful when generating code for browser such as Webpack/Vite dev server.
This disables importing styles and keeps the old behavior that replaces `styleUrls` with empty `styles: []` by default.

Some tests don't import CSS as strings, for example Jest imports them as objects, which breaks Angular. You need to change Jest config to fix this.

To avoid making this a breaking change and force users to change existing config, style importing is disabled by default.
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.

[swc-angular-plugin] preserve styles for using this plugin for dev server
1 participant