Angular export components’s css files into assets

Recently i saw a new angular project (v10) with a curious stucture. Owners said they decided to put all css component files into an asset folder like the example below:

+ src
   + app
      - app.component.ts
      - app.component.html
      - app.component.scss
      - app.module.ts
      - app.routing.ts
      + components
         + foo
            - foo.component.ts
            - foo.component.html
         + bar
            - bar.component.ts
            - bar.component.html 
   + assets
      + scss
         + components
            - foo.scss
            - bar.scss

I’m really curious about this beacuse i always though that it was a bad idea to separate the css of the component in another file but i dont found any documentation or recommendations about this.

Is it a good practice to move the component’s css file to assets ?

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.