I am trying to switch href for <link /> for topic purposes, and SCSS themes are in the package folder of my monorepo, which are symbolically linked in node_modules . I need to be able to compile and reference them.
I ran into the following problem: angular / angular-cli # 3401 and tried to implement something like this:
"styles": [ "styles.scss", { "input": "../node_modules/@org/themes/dark.scss", "output": "dark", "lazy": true } ],
My understanding (possibly incorrect) was that this would compile the dark.scss file into dist/dark.bundle.css and that I could download it via http: // localhost: 4200 / dist / dark.bundle.css , but it does not work as expected. Am I not understanding something or am I doing this completely wrong?
How can I compile the SCSS file from node_modules , which I can then use in the application? Is there any other / better approach I could try instead?
Additional notes:
- Using Angular version
4.2.4 - Using Angular CLI Version
1.3.0 - documentation for this approach
- I work in monorepo, so
node_modules/@org/themes is a symbolic link - I tried using the
ng serve --preserve-symlinks option ng serve --preserve-symlinks in case the problem was higher. It didnโt matter.
I looked at the way the Angular docs Content Site approaches this issue , and it seems like they have a custom build script that compiles SCSS files into CSS files in the assets directory before serving the application. I thought the fixed issue above eliminates the need for this step, but maybe not. Is this the only way to do this?
solvable
Thanks @Kuncevic. I was missing the flag --extract-css .
Working configuration:
"styles": [ "styles.scss", { "input": "../node_modules/@org/themes/src/dark.scss", "output": "themes/dark", "lazy": true } ],
And with the following script service, I can access it through http: // localhost: 4200 / themes / dark.bundle.css :
ng serve --extract-css --preserve-symlinks