public static IFileProvider GetProvider()
{
var provider = new ManifestEmbeddedFileProvider(
assembly: typeof(Setup).Assembly, "Libraries");
return provider;
}
The .AddJavascriptBundle line works without issue, proving that the paths are correct and the provider is working.
The webpage is able to resolve the individual files from the provider without issue with this inclusion at startup.cs/program.cs (depending on your .NET version), so I am confident that the file provider is working normally.
But using .AddFiles does not work with mentioned custom file provider, the page still shows unbundled individual files when requested in browser with cache off.
builder.Services.AddWebOptimizer(pipeline =>
{
var provider = JsPluginHelper.GetProvider();
var libPaths = JsPluginHelper.GetLibraryPaths();
// this works for bundling
pipeline.AddJavaScriptBundle("/dsg-plugin/combined.js", libPaths).UseFileProvider(provider).MinifyJavaScript();
// this does not work for individual files
foreach (var asset in pipeline.AddFiles("text/javascript", "/dsg-plugin/CategoryA/ca.js").)
{
asset.UseFileProvider(provider).MinifyJavaScript();
}
});
Able to confirm whether is it bug or unsupported?
My provider is a ManifestEmbeddedFileProvider:
The .AddJavascriptBundle line works without issue, proving that the paths are correct and the provider is working. The webpage is able to resolve the individual files from the provider without issue with this inclusion at startup.cs/program.cs (depending on your .NET version), so I am confident that the file provider is working normally.
But using .AddFiles does not work with mentioned custom file provider, the page still shows unbundled individual files when requested in browser with cache off.