Skip to content

CSS is not included in pack of multi-targeted library #224

@mikes-gh

Description

@mikes-gh

Describe the bug
Please see #218 for context

That PR fixed a race condition that could lock input/output files when dart-sass was running concurrently.
For example when dotnet packing a multi-targeted build.
By adding the mutex it seems that although the race condition with regards to file locking is fixed, ocassionally the css was not included in dotnet pack. It appears depending on which framework was building the css it might not get included.
I am assuming this is due to the --update flag of dart sass which will result in no stdout when building the scss --> css a second time.

Also related #178

My theory is that this behaviour is to do with the logic that msbuild uses to pickup the staticwebassets for packing in a Blazor library.
Presumably the way in which the staticwebassets is determined is somehow tied to one of the frameworks in a multi-target library.

To test this theory I set our project to unconditionally add MudBlazor.min.css after SassCompiler had run.
See MudBlazor/MudBlazor#10643

To Reproduce
Steps to reproduce the behavior:

  1. Download HEAD of MudBlazor (uses SassCompiler 1.83.0 no mutex)

  2. Always includes MudBlazor.min.css in dotnet pack

  3. Update SassCompiler package to 1.83.1

  4. Sometimes omits MudBlazor.min.css in dotnet pack

  5. Download Build: Fix for missing MudBlazor.min.css in SassCompiler MudBlazor/MudBlazor#10643

  6. Always includes MudBlazor.min.css in dotnet pack

Expected behavior
Always includes MudBlazor.min.css in dotnet pack

Solution
Determine output css from sasscompiler.json. And always include in the Content Items. For folders this would require a bit of logic.
I can do a PR if required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions