# Including javascript lib from node modules

**URL:** https://discourse.gohugo.io/t/including-javascript-lib-from-node-modules/25427
**Category:** support
**Created:** [May 11, 2020, 4:19pm UTC](https://discourse.gohugo.io/t/including-javascript-lib-from-node-modules/25427 "2020-05-11T16:19:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Marcel\_Overdijk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/marcel_overdijk/32/4821_2.png) [@Marcel\_Overdijk](https://discourse.gohugo.io/u/Marcel_Overdijk)
#### Post date: [May 11, 2020, 4:19pm UTC](https://discourse.gohugo.io/t/including-javascript-lib-from-node-modules/25427/1 "2020-05-11T16:19:09Z")

</div>

I’m new to Hugo but I’m wondering how to include jaavascript libs from node\_modules?

I was able to it with css like:

```auto
{{ $options := (dict "targetPath" "style.css" "outputStyle" "compressed") }}
{{ $style := resources.Get "sass/main.scss" | toCSS $options }}

```

and my `assets/sass/main.scss` contains:

```auto
@import "node_modules/bootstrap/scss/bootstrap";
@import "node_modules/@fortawesome/fontawesome-pro/scss/fontawesome";

```

this works nicely.

But I cannot find any documentation how to replace below script inclusions so they are retrieved from `nodule_modules` as well.

```auto
<script src="../../assets/js/vendor/popper.min.js"></script>
<script src="../../dist/js/bootstrap.min.js"></script>

```

---

<div class="post-metadata">

### Author: ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)
#### Post date: [May 11, 2020, 6:27pm UTC](https://discourse.gohugo.io/t/including-javascript-lib-from-node-modules/25427/2 "2020-05-11T18:27:14Z")

</div>

To use load resources via resources.Get etc. from node\_modules you need to mount them into your project (typically /assets, but you may need to mount the fontawesome fonts below /static).

Also note that if you’re not a big fan of NPM, you can mount GitHub projects directly, or use prepared Hugo Modules, e.g.

> **[gohugoio/hugo-mod-bootstrap-scss-v4](https://github.com/gohugoio/hugo-mod-bootstrap-scss-v4)**
>
> Bootstrap SCSS v4 packaged as a Hugo Module. Contribute to gohugoio/hugo-mod-bootstrap-scss-v4 development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)
#### Post date: [May 11, 2020, 6:28pm UTC](https://discourse.gohugo.io/t/including-javascript-lib-from-node-modules/25427/3 "2020-05-11T18:28:01Z")

</div>

> **[Configure Modules](https://gohugo.io/hugo-modules/configuration/#module-config-mounts)**
>
> This page describes the configuration options for a module.

---

<div class="post-metadata">

### Author: ![Marcel\_Overdijk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/marcel_overdijk/32/4821_2.png) [@Marcel\_Overdijk](https://discourse.gohugo.io/u/Marcel_Overdijk)
#### Post date: [May 11, 2020, 6:36pm UTC](https://discourse.gohugo.io/t/including-javascript-lib-from-node-modules/25427/4 "2020-05-11T18:36:51Z")

</div>

Thx a lot!  
The mounts work (and are also needed for the fontawesome webfonts).
