Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 share the same css file across the module

Tags:

angular

It's possible to share the same css file across the same angular 2 module?

I know that I can set View Encapsulation Emulated to inherited parent component css but I want to share the same style across one particular module of my app.

This is my app structure:

  • Main component
    • Module A (shared css style for this module)
      • Component 1
      • Component 2
    • Module B (shared css style for this module)
      • Component 1
      • Component 2
like image 230
John Avatar asked Jan 03 '23 14:01

John


1 Answers

Yes you can. Simply create a file, shared.scss for example. Now you can import it in you components style: @import './styles/shared.scss'; You could also add it to your styleUrls in your component.

like image 73
Robin Dijkhof Avatar answered Jan 18 '23 10:01

Robin Dijkhof