-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular doesn't properly bundles stylesheets into the library's output #28199
Comments
Node module packages should not be imported using relative paths. This rule applies to both JavaScript and CSS files in application and library builders. Incorrect: @import '../node_modules/@syncfusion/ej2-base/styles/material.css'; Correct: @import '@syncfusion/ej2-base/styles/material.css'; |
Hi @alan-agius4 , Thanks for the update still facing same issues. |
Out of curiosity, why not include the CSS in the global stylesheet of the application? It seems like the referenced CSS is intended for global use rather than being tied to a specific component. Importing it directly into a component could significantly increase its size, especially if these stylesheets are also used in other components. I tried building this locally, but it seems that one of the stylesheets isn't exported correctly:
|
why not include the CSS in the global stylesheet of the application? We would like to contain the required styles for the scheduler component in the library itself, as well as the referenced styles is for scheduler dependent styles as it implements and holds other components in it. I tried building this locally, but it seems that one of the stylesheets isn't exported correctly: You can add: @import '@syncfusion/ej2-schedule/styles/material.css'; instead @import '@syncfusion/ej2-angular-schedule/styles/material.css'; |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
build
Is this a regression?
The previous version in which this bug was not present was
Not applicable
Description
We are Syncfusion, and we are seeking your guidance regarding an issue we are experiencing with our components in an exportable Angular library. Basically, we are trying to contain styles in the library itself and do not want to explicitly import any styles into the application that consumes the library.
We are currently utilizing the Syncfusion Angular Scheduler component in an exportable Angular library. You can find more details here.
Conventionally, we provide styles for our ej2-angular-scheduler control by importing them from the node_modules directory as follows:
We have encountered an issue where, during the ng build process, the styles are bundled correctly in a standard Angular application and the component renders as expected. However, when building the same component within an Angular library and when we packed and export it, the styles are not bundled properly, leading to issues with the component rendering in the consuming application it take more time for compilation as well as styles not applied.
Could you please provide guidance on how to resolve this issue or suggest best practices for managing styles in Angular libraries to ensure they are properly bundled and applied?
Thank you for your assistance.
Minimal Reproduction
We have attached a sample demonstration where an exportable Angular library (mylib) contains the Scheduler component. The MyApp sample shows how we packed the library and utilized the library in an application that consumes it without explicitly adding styles.
Demostration.zip
Replication procedure:
Exception or Error
Your Environment
Anything else relevant?
Not applicable
The text was updated successfully, but these errors were encountered: