-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Hi,
Firstly apologies, this may be more of a question/feature request than a bug, but I wasn't quite sure where to put it.
I have a ASP.Net hosted Blazor web assembly application. I'm trying to cache bust the JS and CSS files in my project because I'm struggling to get the browser to refresh them when I redeploy. In desktop I can refresh with CTRL-F5, but this is not so easy in mobile browsers and my application can go screwy if it doesn't have the latest files and obviously end users will struggle to clear the cache.
I have read the two similar issues: #27047 and #27966 and have implemented my own cache busting on the ASP.Net side by adding a version in the URL as a query parameter. I did this by hosting Blazor in razor page and using a function to add a version where required.
This seems to work OK, but I have a component library project in my solution and I'm not sure how I can do the same for the CSS generated by CSS isolation in the component library ("_content/ClassLib/ClassLib.bundle.scp.css"),
Currently this is included "automatically" by using an @import statement at the top of the main project;s 'bundled' CSS which I don't seem to have any control of. I believe my 2 options are:
- Include a version on the
@import, however this is created by the Blazor tooling so as far as I know I have no way of doing it. - Stop Blazor generating the
@importstatement and include it myself in the hosting razor page as per all the other CSS.
Can you advise if either option is possible or you have any other suggestion? In regard to option 2 I've found the DisableScopedCssBundling property, but I presume this stops the CSS being generated at all?
Thanks in advance!
LJ