AspNetCore.SassCompiler
AspNetCore.SassCompiler copied to clipboard
Multiple builds required
Describe the bug Multiple builds are required before my main css file is generated (usually 2, sometimes 3). Sometimes it doesn't even get generated at all unless I delete all the generated .css files first. I use SASS, all my .sass files are in a Razor Class Library, I have a general file, under Styles/app.sass, compiled into wwwroot/app.css of the same assembly, and other files are coupled to components for css isolation. In my main project it's actually broken CSS isolation, I have no idea how to fix it.
To Reproduce Steps to reproduce the behavior:
- Create a simple Blazor Server App
- Add a RCL to the solution and reference it from the Blazor project
- Move the razor components to the RCL project (keep
App.razor
andRoutes.razor
in Blazor project) - Add a reference to AspNetCore.SassCompiler from the RCL project (using
ReferenceOutputAssembly="false"
) - Add necessary references:
- Router:
<Router AppAssembly="typeof(Program).Assembly" AdditionalAssemblies="@( new[] { typeof( MainLayout ).Assembly } )">
(MainLayout.razor
lives in the RCL project) -
Program.cs
:app.MapRazorComponents< App >().AddInteractiveServerRenderMode().AddAdditionalAssemblies( typeof( MainLayout ).Assembly );
- Add
sasscompiler.json
to the RCL project with the following content:
{
"ScopedCssFolders": ["."],
"Source": "Styles",
"Target": "wwwroot",
"Configurations": {
"Debug": {
"Arguments": "--style=expanded"
}
}
}
Expected behavior When building, the file wwwroot/app.css should be generated (in the RCL project), and it's never generated on first build. Once it's built a couple of times, the file appears, once it's there, it doesn't always get updated unless I delete it and all other generated css files.
Desktop (please complete the following information):
- OS: macOS Sonoma 14.6.1
- IDE: Rider 2024.2.5