You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
? (env.WebRootFileProvider as CompositeFileProvider).FileProviders.Last()
Umbraco10 invisibly adds a number of FileProviders, meaning that the PhysicalFileProvider one would expect to map to wwwroot was not the one used in the Sass compilation pipeline.
Specifcally re-adding a PhysicalFileProvider in after the Umbraco middleware was required in order to get things working as expected again.
IWebHostEnvironment? webHostEnvironment = app.ApplicationServices.GetService<IWebHostEnvironment>(); if (webHostEnvironment is not null) { webHostEnvironment.WebRootFileProvider = new CompositeFileProvider( new PhysicalFileProvider(env.WebRootPath), env.WebRootFileProvider); }
I'm not sure how flexible / intuitive it is that FileProviders.Last() is the one that all assets are routed through...
I'm adding this issue in case it helps anyone facing the same problem.
The text was updated successfully, but these errors were encountered:
I'm using Umbraco 12.3.7 and getting the last FileProvider doesn't work, just leave it as a CompositeFileProvider works well for me.
Here's my code:
Line 265, function GetFileProvider: public static IFileProvider GetFileProvider(this IAsset asset, IWebHostEnvironment env) { return asset.GetCustomFileProvider(env) ?? env.WebRootFileProvider; }
I was facing this exception yesterday, using WebOptimizer.Sass 3.0.91 with Umbraco 10.
The setup had been stable on WebOptimizer.Core 3.0.357 and WebOptimizer.Sass 3.0.84 but updating introduced this breaking change.
After some investigation, I tracked this down a commit in the WebOptimizer.Core project ligershark/WebOptimizer@5f83850
Line 265
? (env.WebRootFileProvider as CompositeFileProvider).FileProviders.Last()
Umbraco10 invisibly adds a number of FileProviders, meaning that the PhysicalFileProvider one would expect to map to wwwroot was not the one used in the Sass compilation pipeline.
Specifcally re-adding a PhysicalFileProvider in after the Umbraco middleware was required in order to get things working as expected again.
IWebHostEnvironment? webHostEnvironment = app.ApplicationServices.GetService<IWebHostEnvironment>(); if (webHostEnvironment is not null) { webHostEnvironment.WebRootFileProvider = new CompositeFileProvider( new PhysicalFileProvider(env.WebRootPath), env.WebRootFileProvider); }
I'm not sure how flexible / intuitive it is that
FileProviders.Last()
is the one that all assets are routed through...I'm adding this issue in case it helps anyone facing the same problem.
The text was updated successfully, but these errors were encountered: