AnderssonPeter/CompressedStaticFiles

Blazor WASM support?

pm64 opened this issue · 6 comments

pm64 commented

I can see this library likely works great for Blazor Server, but could it be extended to add compressed static resource support in Blazor WASM applications?

Sorry for the late reply, i havent had any interest in blazor yet so i have no idea how it works and sadly have no idea if and how to support it.

I can see this library likely works great for Blazor Server, but could it be extended to add compressed static resource support in Blazor WASM applications?

WASM is client side, so you get detached from server just like angular, react etc so the files server is serving have no way to be controlled by pure WASM.. but as a work around you can put all the static files on a subdomain and treat it as a file server (or make a bunch of them to mimic cdn) this is a workaround, you can also control content headers but thats it when you are sitting on client end .

pm64 commented

Thank you @aloksharma1 for providing your thoughts. I agree that deploying a secondary server-side application for the purpose of serving image files would facilitate the desired behavior in Blazor WASM. A simpler pure-client solution that does not involve a separate file server is obviously possible, but perhaps not in a way that reconciles with this library's API. It would be nice for both Server and WASM to be handled through a common mechanism.

Thank you @aloksharma1 for providing your thoughts. I agree that deploying a secondary server-side application for the purpose of serving image files would facilitate the desired behavior in Blazor WASM. A simpler pure-client solution that does not involve a separate file server is obviously possible, but perhaps not in a way that reconciles with this library's API. It would be nice for both Server and WASM to be handled through a common mechanism.

iirc WASM can also be hosted in server side app, so maybe you can try this mixed approach, but i have checked again pure client side WASM wont have any control on server behavior.

pm64 commented

Well a pure client-side solution could exist in which the client explicitly requests the best static resources it can support. But this would require special markup, which would not reconcile with this library's API. So a complete solution supporting both Blazor Server and Blazor WASM would impose such markup on Blazor Server components as well, even though the actual requests would likely be handled differently in the two cases. This is the only way to facilitate components supporting compressed static resources, where the components themselves are interchangeable between Server and WASM.

As i said I'm a total noob when it comes to blazor but arent static resources like html, css, images and javascript requested normally? If that is the case then this library should still help there? The only thing that then wouldn't be precompressed would be the application code?