Hi Stephan,
Query 1: All the components require one or more css files to be added globally. This looks unusual to me.
We maintain style sheet for each components separately, so we need to include the styles of dependent component also. But, we could use the style sheet of ej2 package which contains the styles of all components in single file to eliminate the multiple file reference.
Install EJ2 package in your application using below command.
Then add the style reference in your application. Please find the below link.
@import ‘../node_modules/ej2/material.css’ |
Query 2: Shouldn't such style just be declared in the components requiring them? Shouldn't the styles used by the button simply be declated in buton.component.ts? What is the advantage of this?
Bundle size will be large if we include the style reference in .ts file since style also will be included in the generated bundled file. So, we didn’t include the css files inside .ts files.
Please get back to us if you required any further assistance on this.
Regards,
Jesus Arockia Sankaran S