As I embark on my inaugural project utilizing Angular4
and sass
, I am grappling with the best approach for working with sass
. My setup involves using angular-cli
with a default style configuration set to utilize scss
syntax. I have also configured the compilation process accordingly.
However, I have encountered an issue with the styleUrls option in the component, where specific styles are designated for use only within that component.
The dilemma arises when I specify a scss
file in a particular component
, as it fails to generate its own corresponding .css
file or include it within the main .css
file generated from the root of the project.
My project structure is organized as follows:
app
app.module.ts
app.routing.ts
home
home.component.ts
home.html
_home.scss
client
client.component.ts
client.html
_client.scss
scss
_imports.scss
colors
_colors.scss
ui
_button.scss
_table.scss
//.. more folders and files
styles.scss
index.html
I aim to define the primary css
style in the styles.scss
file, which will later be injected into the index.html
file during the build process. Additionally, I want the ability to generate a separate css
file for each individual component, such as home
and client
, and exclusively apply those styles within their respective components.
Is there a way to achieve this desired functionality? Despite my attempts, I have yet to come across any other resources addressing this specific challenge!