I have created a style library in our Nx Workspace with the --publishable
flag. This is because we will need to publish the styles as an npm package to use the styles in other products that aren't in our Nx Workspace.
I have done this previously using a webpack.config.js
but am trying to do this via the Nx commands.
When I run the Nx:build command it doesn't include the scss files (as expected). To get round this, I tried:
Attempts to make it work
I added this to the angular.json
file in project/{{lib-project}}/architect/build/options
"stylePreprocessorOptions": {
"includePaths": [
"src/style-paths"
]
}
This fails with the message:
———————————————————————————————————————————————
> nx run shared-ui:build:development --watch
'stylePreprocessorOptions' is not found in schema
———————————————————————————————————————————————
Trying this with the styles or assets tags give me the same warnings.
It appears these work when the projectType
is application
but fails when it is library
.
Why are these errors happening when according to the docs there is no mention of these being projectType
specific.
Any help with how are you meant to compile the SCSS files without these commands in Nx?
TL;DR
I want to create a publishable styles lib to push to npm but it's unclear how to compile and move the SCSS, without using webpack
, to the generated dist folder.