The Goal:
I am trying to include a path from my library so I can use an @import
statement to include the scss files in my application like so:
@import "some-scss-in-my-lib"
The Problem:
Unfortunately everytime I try to serve my application I am getting the following compiler error:
SassError: Can't find stylesheet to import.
What I've already tried:
Looking up the search on Stackoverflow brought me this thread which describes the same problem as I'm facing now. And I've tried to include the path with the
styleIncludePaths
property just like Zainu suggested but when trying to serve the application I've ran in to the exact Problem as described in The Problem-Section above.I tried to set the
stylePreprocessorOptions
property like GreatHawkeye in the first post and it was possible to@import
the scss file after usingng build
, but I can't understand how and why this is working forstylePreprocessorOptions
but notstyleIncludePaths
?I also tried searching on google which lead me to the Thread Unable to get styles bundled using styleIncludePaths option where I found an answer by Alan Aguis, but unfortunately there was no real explanation what styleIncludePaths really is for. The only thing that Alan Aguis said was:
that is because styleIncludePaths is indented for something else.
But as said, he didn't say for what exactly styleIncludePaths is, which confused me even more.
I also tried to lookup the ng-packagr github page regarding the documentation about Add Style Include Paths on the Thread How to use "styleIncludePaths" but the result was still the same and I couldn't find a clear answer to my problem.
Questions about this Issue:
When is styleIncludePaths in ng-package.json used? Is it used for published packages only?
When is stylePreprocessorOptions in angular.json used? Is it used for the dist version only after running ng build?
What in general is the difference between styleIncludePaths from ng-package.json compared to stylePreprocessorOptions from angular.json?
How do I declare/include an imported scss folder in my library so I can call @import it in my application's scss files?
I'm pretty much sure that I'm wrong in my suggestions but I'd like to know what is going on and how to resolve my issue.
Any help on this is as always highly appreciated! 🙏🏻