Open
Description
When adding an scss bundle with source files from a Razor Class Library project:
pipeline.AddScssBundle("/shared.css", "_content/WebApplication1.SharedAssets/styles/shared-styles.scss");
SCSS compilation fails with the following error:
System.Exception: CacheKey generation exception in WebOptimizer.Sass.Compiler processor
---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Me\Sample\WebApplication1\WebApplication1\wwwroot\_content\WebApplication1.SharedAssets\styles\shared-styles.scss'.
at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at Microsoft.Extensions.FileProviders.Physical.PhysicalFileInfo.CreateReadStream()
at WebOptimizer.Sass.Compiler.GenerateCacheKey(HttpContext context, IAssetContext config)
at WebOptimizer.Sass.Compiler.CacheKey(HttpContext context, IAssetContext config)
at WebOptimizer.Asset.GenerateCacheKey(HttpContext context, IWebOptimizerOptions options)
--- End of inner exception stack trace ---
at WebOptimizer.Asset.GenerateCacheKey(HttpContext context, IWebOptimizerOptions options)
at WebOptimizer.AssetBuilder.BuildAsync(IAsset asset, HttpContext context, IWebOptimizerOptions options)
at WebOptimizer.AssetMiddleware.HandleAssetAsync(HttpContext context, IAsset asset, WebOptimizerOptions options)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
It works fine when creating a plain CSS bundle:
pipeline.AddScssBundle("/shared-2.css", "_content/WebApplication1.SharedAssets/styles/shared-styles-2.css");
So it is just the SCSS compiler that is throwing an error.
Refer to this PR for how it was fixed in the main WebOptimizer project:
Metadata
Metadata
Assignees
Labels
No labels