Styles from library are not loading
See original GitHub issueI used this generator to create a boilerplate for developing a component library for Angular 4. All these components have separate template and style files. However, when I install the library package in an empty Angular application, the component styles aren’t applied. The templates and styles are being inlined and I can see them in the generated .js
files. The templates and actual code from the library work fine though. Do I need to change a setting or something like that?
An example component in the js
bundle file looks like this:
AppComponent.decorators = [
{ type: Component, args: [{
selector: "app",
styles: ["div[data-width-unit=\"0\"] { font-weight: bold; } h1, h2, h3, h4, h5, h6 { display: inline; }"],
encapsulation: ViewEncapsulation.None,
template: "<router-outlet></router-outlet>"
},] },
];
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Styles not importing - Ask the community
The importing of styles from shared libraries is broken. I've tried with multiple Figma files and with multiple libraries.
Read more >Nextjs styles from a shared library are not loaded on initial ...
I have a Nextjs app and a shared UI library that is being used not only for Nextjs app but also other apps...
Read more >Styles not injected when importing another package that uses ...
I have a monorepo with a component library that is built using Babel. The moment styled-components is imported in that library, the styles...
Read more >custom style.css not loading [#2630670] | Drupal.org
The style.css file was compiling correctly, but the style.css file was in stylesheets, when the libraries file said it was in css. Changing...
Read more >Creating libraries - Angular
If your library provides optional services that might not be used by all client ... your library as part of the build and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The problem had to do with
ViewEncapsulation
. There was a component withViewEncapsulation.None
in the library and I expected its styles to also globally apply in the consuming application. Turns out that that is not the case. Maybe you have the same issue @sebvieira ?@kajnelissen — Thank you for the update. I will close this issue but feel free to re-open if you feel it is related to this generator. Thanks!