question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Styles from library are not loading

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
kajnelissencommented, Jul 4, 2017

The problem had to do with ViewEncapsulation. There was a component with ViewEncapsulation.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 ?

0reactions
jvandemocommented, Jun 26, 2017

@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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found