Home Importing a css stylesheet in a module
Reply: 0

Importing a css stylesheet in a module

user890
1#
user890 Published in April 26, 2018, 8:49 pm

I'm publishing a module on NPM. In that module I have several components, which use ngx-bootstrap/datepicker. That requires a certain stylesheet imported out of node_modules.

Now the problem is: I can't find a way to import that stylesheet for that module.

There are two solutions I have found:

  1. Import the stylesheet in the global styles.css of the application (or in angular-cli.json)
  2. Import the stylesheet in every component of my module

The problems are: I would like to avoid the first solution, since I would like my module to work out of the box when imported. The second solution does not work, I think it has something to do with the scope. Even if it would work, it's a dirty solution, since I have to import the file in every component where I need it.

Does anyone have a solution for that problem?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.305624 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO