Closed cpboyd closed 3 years ago
Hi @cpboyd
I'm also using this with CSS isolation in Blazor, and it should wait for the Sass compilation.
How are you building your solution? With VS, or CLI dotnet build
?
Do you perhaps have steps to replicate your issue?
I am seeing the same issue. I have to run a dotnet build first. and then a dotnet publish else the dotnet publish command wont find the compiled css files.
Repro steps:
test.scss
to the wwwroot folder with content body { background-color: blue;}
dotnet publish -o output
output
folder and verify the expected test.css
file is not there.dotnet publish -o output
againoutput
folder and verify the expected test.css
file there.Thanks @Thnslj
I'm following your steps with the below commands:
dotnet new blazorwasm
dotnet add package LibSassBuilder
echo "body { background-color: blue; }" > wwwroot/test.scss
dotnet publish -o output
On both Windows & Ubuntu this works and I can see Sass compile files
as part of my dotnet publish
output:
jvr@JvR-XPS:~/sourcecode/cssgenerationissues$ dotnet publish -o output
Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
Sass compile files
Sass files compiled
cssgenerationissues -> /home/jvr/sourcecode/cssgenerationissues/bin/Debug/net5.0/cssgenerationissues.dll
cssgenerationissues (Blazor output) -> /home/jvr/sourcecode/cssgenerationissues/bin/Debug/net5.0/wwwroot
Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
Compressing Blazor WebAssembly publish artifacts. This may take a while...
cssgenerationissues -> /home/jvr/sourcecode/cssgenerationissues/output/
jvr@JvR-XPS:~/sourcecode/cssgenerationissues$ ls output/wwwroot/
_framework cssgenerationissues.styles.css.br favicon.ico.br index.html.br test.css
css cssgenerationissues.styles.css.gz favicon.ico.gz index.html.gz test.css.br
cssgenerationissues.styles.css favicon.ico index.html sample-data test.css.gz
jvr@JvR-XPS:~/sourcecode/cssgenerationissues$ cat output/wwwroot/test.css
body{background-color:blue}
jvr@JvR-XPS:~/sourcecode/cssgenerationissues$
Which platform & versions are you using? Maybe try send me your console output if possible?
I was running on Windows 10 with the Visual Studio "run" button. At the moment, I'm not able to use the dotnet CLI to add packages due to 401 errors from private sources (apparently resolving in VS doesn't necessarily add them for the CLI).
I do recall seeing it actually run and update the individual file... but the merged test.styles.css
or whatever wouldn't contain the updates (perhaps due to some parallel build process).
Were you editing the file while the app was running? Can you share your build output? Also maybe try disabling any extra VS extensions you might have to see if that makes a difference?
When I edit the file between VS runs, my output looks like this:
I'm really struggling to replicate this. Last resort if you can maybe share a github repo to reproduce your situation?
After setting up the project from scratch, I wasn't able to reproduce so I'll close this for now.
Thanks for looking into it.
I found this project after searching for a more up-to-date Sass implementation from Delegate.SassBuilder.
I'm using CSS isolation in Blazor, per: https://docs.microsoft.com/en-us/aspnet/core/blazor/components/css-isolation?view=aspnetcore-5.0#css-preprocessor-support
Is there a way to ensure that the Blazor build waits on the Sass compilation to complete first? It seems that the Blazor build continues without waiting for the CSS files to be generated first (and thus missing any changes in that build).
Additionally, CSS isn't re-generated (possibly due to the hash check) when CSS files are manually deleted.