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

CSS isolation does not work #355

Open
masq6r opened this issue May 11, 2024 · 7 comments · Fixed by #364
Open

CSS isolation does not work #355

masq6r opened this issue May 11, 2024 · 7 comments · Fixed by #364
Labels
bug Something isn't working

Comments

@masq6r
Copy link

masq6r commented May 11, 2024

I followed the document and created a Bolero app but I could not make CSS isolation work because the CssScopes module is not generated.

To reproduce the issue:

  1. Create the project with dotnet new bolera-app.
  2. Check the existence of link { attr.rel "stylesheet"; attr.href "HelloWorld.Client.styles.css" } in Index.fs of HelloWorld.Server.
  3. Check the existence of MyApp.bolero.css of HelloWorld.Client.
  4. Comment the line override _.CssScope = CssScopes.MyApp in Main.fs of HelloWorld.Client, and build the whole solution in VS2022 GUI.
  5. Once the build completed, uncomment the line above and the compiler will give the FS0039 error, CssScopes is not defined.

My dotnet --version is 8.0.204 on Windows 10, Bolero, Bolero.Build, Bolero.Server are 0.23.52.

@Tarmil Tarmil added the bug Something isn't working label May 22, 2024
@Tarmil
Copy link
Member

Tarmil commented May 22, 2024

This is strange. I am failing to reproduce the issue (I'm on dotnet 8.0.300).

@fwaris
Copy link

fwaris commented Aug 17, 2024

I think its broken in 8.0.4 (just upgraded)
The following global.json fixes it, for now.

{
    "sdk": {
      "version": "8.0.301",
      "rollForward": "disable",
      "allowPrerelease": false
    }
  }

@rabejens
Copy link

THis works on the cmdline, but fails in Visual Studio because the newest VS forces using 8.0.4xx despite global.json being set.

@lamg
Copy link

lamg commented Oct 31, 2024

I have the same problem with 8.0.403 in Linux

@Tarmil
Copy link
Member

Tarmil commented Dec 8, 2024

Okay, just to check if I have the correct reproduction: what I see is that CssScopes is not recognized by VS and underlined in red, but the project still builds and runs. Is that correct?

@Tarmil
Copy link
Member

Tarmil commented Dec 8, 2024

It looks like I can fix this by simply always including the generated obj/CssScopes.cs, no matter if there are any scoped CSS or not.

(Right now there's a condition, and it seems the VS background service doesn't detect that it has changed)

@Tarmil
Copy link
Member

Tarmil commented Dec 8, 2024

I published v0.24.38, it should fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants