-
Notifications
You must be signed in to change notification settings - Fork 10.3k
JS Isolation in Blazor Components #23560
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
Comments
Thanks for contacting us. |
Hey folks, Does this addition mean a custom attribute will be added to generated HTML markup like with scoped CSS? |
No. The form of JS isolation we have added is the ability to load and invoke ES6 modules. They are not tied to specific components (except by the developer's own convention if they so choose). |
Hello, This is the most suitable way for a angular devs |
@Amine-Smahi You can have any naming convention you want. If you want to have one JS file per component, you can certainly do that. The one limitation is that the |
The problem is not in the naming convention specifically, but rather in the location of the js file. I would like to thank the team again for the amazing work but i think it’s a bit missy to have to switch between wwwroot and component location for each component (if you opt for the component style js isolation) |
@Amine-Smahi my first thought is that this should be doable by a build script/msbuild step, that finds all .js/.ts files in a Blazor class lib/app and copies them to wwwroot at build time. |
@egil That is a very good workaround, for now. But long-term I think most of us with previous SPA experience would strongly agree with @Amine-Smahi (discoverability of files in a complex solution is hard enough without splitting files across multiple directories). Also agree with him that this is still v1, and awesome as is. Since @SteveSandersonMS is receptive to the idea, I'm sure (/hope 😄) we'll see something more streamlined in vNext. |
@Amine-Smahi I suppose you could copy your comment into a new backlog issue so no one forgets about it? |
Folks if you agree with @Amine-Smahi that we need colocated cs/css/js files per component, please upvote the new issue here. |
JS isolation has been discussed in many separate issues (example). I'm sure the team intends to tackle this at some point, but it hasn't been tracked as an independent issue, until now.
JS Isolation per Blazor component would be appreciated because:
The text was updated successfully, but these errors were encountered: