-
Notifications
You must be signed in to change notification settings - Fork 12k
Workspace library scss import #23552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The sass actually doesn't actually support package exports, so the exports cannot be used to rename/shorten the paths of stylesheets, as such in the above case the You will also need to do a couple of other steps;
|
Thank you for the fast reply.
According to my testing it actually works - but only if the library is located under The compiled library files (copied into
The source stylesheet file of the sandbox app:
And after a successful compilation, the destination contains the expected css:
May I misunderstand something? It only works if the library is located under
Forgot to mention that in the OP that I've tried these steps, but now I've done it again, and the result is the same. As you've stated, the "aliasing" does not work in this case, so
However, I can't seem to figure out why the two cases ( |
This works because Webpack sass-loader has it's own resolver but when using Sass directly this doesn't work. I don't suggest to rely on this behaviour though. |
I'm trying to use https://github.com/LuisGazcon/sass-alias with
do you guys have the ability to make it extensible? |
Shouldn't an Angular library recognize a .scss file and compile it into css the way an app does? |
🦆 been here, done that.. |
Any news? |
🚀 Feature request
Command (mark with an
x
)Description
With a workspace architecture, the exported stylesheets cannot be imported using package name. Given a library (
lib
) and a project (app
) in an angular workspace. The library properly copies an scss file to thedist
folder (which is the default output folder) and adds it to theexports
section of thepackage.json
. However, the consuming app cannot@import
or@use
the exported scss file.Given the following files:
And the following export in the
package.json
of the library:And the default settings that the Angular CLI generates (with
ng new library
and so on...),Describe the solution you'd like
With the settings mentioned above, importing an exported scss file should work out of the box (currently it does not compile with the error
SassError: Can't find stylesheet to import.
).Describe alternatives you've considered
dist
output of the library to thenode_modules
and the automatically removed@
symbol is added to the path (in shortdist/my-company/my-lib
->node_modules/@my-company/my-lib
) resolves the scss import problem. Thetsconfig.json
must be adjusted as well. If this is the desired solution, then it should be the default generated with the CLI.tsconfig.json
does not need to define additionalpaths
and this should be an operation that the generation (through the CLI) does automatically. Or at least extend the documentation.The text was updated successfully, but these errors were encountered: