AspNetCore.SassCompiler icon indicating copy to clipboard operation
AspNetCore.SassCompiler copied to clipboard

Multiple builds required

Open sebdesalvador opened this issue 5 months ago • 3 comments

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:

  1. Create a simple Blazor Server App
  2. Add a RCL to the solution and reference it from the Blazor project
  3. Move the razor components to the RCL project (keep App.razor and Routes.razor in Blazor project)
  4. Add a reference to AspNetCore.SassCompiler from the RCL project (using ReferenceOutputAssembly="false")
  5. 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 );
  1. 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

sebdesalvador avatar Oct 03 '24 18:10 sebdesalvador