We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Motivation for global styles

Thread ID:

Created:

Updated:

Platform:

Replies:

144726 May 20,2019 06:52 AM UTC May 21,2019 05:11 PM UTC Angular - EJ 2 1
loading
Tags: General
Stephan Schuster
Asked On May 20, 2019 06:52 AM UTC

All the components require one or more css files to be added globally. This looks unusual to me. 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?

Jesus Arockia Sankaran S [Syncfusion]
Replied On May 21, 2019 05:11 PM UTC

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. 
 
npm i @syncfusion/ej2 
 
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 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon