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

Only enable scoped CSS when using Razor SDK #31359

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

MackinnonBuck
Copy link
Member

Only enable scoped CSS when using Razor SDK

The scoped CSS feature has a dependency on targets defined in the Razor SDK. In order to allow the StaticWebAssets SDK to be used without the Razor SDK, this PR enables scoped CSS only when the Razor SDK is used.

Fixes dotnet/aspnetcore#47314

@MackinnonBuck MackinnonBuck added the Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch label Mar 21, 2023
@ghost
Copy link

ghost commented Mar 21, 2023

Thanks for your PR, @MackinnonBuck.
To learn about the PR process and branching schedule of this repo, please take a look at the SDK PR Guide.

@javiercn
Copy link
Member

javiercn commented Mar 21, 2023

For extra points, we should also clean up the other locations where the StaticWebAssets SDK depends on the Razor SDK.

I found the following targets AssignRazorComponentTargetPaths and AssignRazorComponentTargetPaths the one in

image

The one in JS modules seems like an error. For the other two, something in the Razor SDK should turn on the feature (instead of us) and define the dependency on the scoped CSS step so that it is the Razor compiler the one that controls when the feature is on and how it applies.

https://github.com/search?q=repo%3Adotnet%2Fsdk+AssignRazorComponentTargetPaths+lang%3Axml&type=code

@MackinnonBuck
Copy link
Member Author

@javiercn that all sounds good to me. Do you mind if I address those items in a follow-up PR so we unblock #31154?

@javiercn
Copy link
Member

javiercn commented Mar 22, 2023

@MackinnonBuck nope.

This is good to go.

We want, if possible to keep the layering clean where dependencies flow:

flowchart LR
BlazorSdk-->WasmSdk
BlazorSdk-->RazorSdk
WasmSdk-->StaticWebAssetsSdk
RazorSdk-->StaticWebAssetsSdk
Loading

@MackinnonBuck MackinnonBuck merged commit 365a2b7 into main Mar 22, 2023
@MackinnonBuck MackinnonBuck deleted the mbuck/conditionally-enable-scoped-css branch March 22, 2023 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Static web assets SDK depends on targets defined in Razor SDK
2 participants