OYIon / LiveSharp

Public repository for the LiveSharp project
96 stars 4 forks source link

.NET 5: Support for isolated CSS in Blazor WebAssembly #91

Closed ChristianWeyer closed 3 years ago

ChristianWeyer commented 3 years ago

Hi!

I know that you are still working on .NET 5 support. It would be great and very helpful if you could look into supporting live reloading changes in isolated CSS files in Blazor WASM. Those changes need a compile step to happen.

Thanks.

ionoy commented 3 years ago

Hi @ChristianWeyer

Good news! Support for isolated CSS hot-reload is coming in the new version. I'm already testing it locally, so it should be available in a few days.

ionoy commented 3 years ago

Isolated CSS support is included in 1.6.17. Please see if it works in your case.

ChristianWeyer commented 3 years ago

Just tried it, get this exception:

18:03:45.107: Starting job: Bundle scoped css
18:03:46.311: /Users/christianweyer/sources/blazor-webassembly-demo/Client/obj/Debug/net5.0/scopedcss/bundle/ConfTool.Client.styles.css updated
18:03:47.168: /Users/christianweyer/sources/blazor-webassembly-demo/ClientModules/ConferencesModule/obj/Debug/net5.0/scopedcss/bundle/ConfTool.ClientModules.Conferences.styles.css updated
18:03:47.176: /Users/christianweyer/sources/blazor-webassembly-demo/ClientModules/StatisticsModule/obj/Debug/net5.0/scopedcss/bundle/ConfTool.ClientModules.Statistics.styles.css updated
18:03:47.260: Job failed: Bundle scoped css
System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/christianweyer/sources/blazor-webassembly-demo/ClientModules/StatisticsModule/obj/Debug/net5.0/scopedcss/bundle/ConfTool.ClientModules.Statistics.styles.css'.
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
   at System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding)
   at System.IO.File.ReadAllText(String path)
   at LiveSharp.LiveSharpWorkspace.<>c__DisplayClass29_0.<ResourceFileChanged>b__0()
   at LiveSharp.Infrastructure.JobQueue.<>c__DisplayClass6_0.<AddJob>b__0(Task _)
ionoy commented 3 years ago

Can you check if any of these files exist?

ChristianWeyer commented 3 years ago

Nope, they are not there:

image

Most probably, as in this class lib there are no scoped CSS files.

BTW. the entire sample is here: https://github.com/thinktecture/blazor-webassembly-demo/tree/net5-rc2

ionoy commented 3 years ago

Thanks for the sample! This will make it easier.

ionoy commented 3 years ago

Please try this build when you have time. It should fix the issue.

LiveSharp.1.6.21.zip

ChristianWeyer commented 3 years ago

Now it works, thanks!