# Import css from node\_modules

**URL:** <https://discourse.aurelia.io/t/import-css-from-node-modules/2644>\
**Category:** Help Requests\
**Created:** [June 14, 2019, 6:44pm UTC](https://discourse.aurelia.io/t/import-css-from-node-modules/2644 "2019-06-14T18:44:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![roddharris](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/roddharris/32/1340_2.png) [@roddharris](https://discourse.aurelia.io/u/roddharris)\
**Post date:** [June 14, 2019, 6:44pm UTC](https://discourse.aurelia.io/t/import-css-from-node-modules/2644/1 "2019-06-14T18:44:40Z")

</div>

I’m trying to use c3.js to add some charts and graphs to my site. I did an `npm install c3` and am able to reference c3 in my VM using `@import c3 from 'c3'`.

However, the associated .css is not loaded so there are a few quirky display issues.

What is the best way to reference the associated `c3.min.css` from the c3 folder of my `node_modules`?

- Do I have to copy the .css file locally into my src? (Yuck)
- Do I do an import with a hardcoded reference to the css file: `node_modules\c3\dist\c3.min.css`. (Yuck again)
- Do I simply load it from cdnjs in my index.ejs file? `<link rel="stylesheet" href=".../c3.min.css" />`
- Given that webpack/node are able to locate c3 without a path when referencing it in my VM (`@import c3 from 'c3'`), is there a way to do the same with `css`?

Thanks for your help

---

<div class="post-metadata">

**Author:** ![m0ngr31](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/m0ngr31/32/1535_2.png) [@m0ngr31](https://discourse.aurelia.io/u/m0ngr31)\
**Post date:** [June 14, 2019, 6:47pm UTC](https://discourse.aurelia.io/t/import-css-from-node-modules/2644/2 "2019-06-14T18:47:45Z")

</div>

Try doing something like this:

```
import c3 from 'c3';
import 'c3/dist/c3.min.css';

```

But it depends on how your webpack is setup for css too.

---

<div class="post-metadata">

**Author:** ![roddharris](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/roddharris/32/1340_2.png) [@roddharris](https://discourse.aurelia.io/u/roddharris)\
**Post date:** [June 14, 2019, 7:10pm UTC](https://discourse.aurelia.io/t/import-css-from-node-modules/2644/3 "2019-06-14T19:10:31Z")

</div>

Wow, that was way too easy! 🙂

So one further question. Should I do that in `main.js` or only in the VMs that actually need to display reporting? If I have multiple VMs that use reporting, will the `.css` get loaded multiple times – or does that all depend on webpack?

---

<div class="post-metadata">

**Author:** ![m0ngr31](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/m0ngr31/32/1535_2.png) [@m0ngr31](https://discourse.aurelia.io/u/m0ngr31)\
**Post date:** [June 14, 2019, 7:35pm UTC](https://discourse.aurelia.io/t/import-css-from-node-modules/2644/4 "2019-06-14T19:35:19Z")

</div>

If you are using it more than once, it makes sense to put it in main.js, but I’m sure webpack prevents it from duplicating if you want to put it in multiple VMs
