# How to organize static and asset files from the same npm package?

**URL:** <https://discourse.gohugo.io/t/how-to-organize-static-and-asset-files-from-the-same-npm-package/43014>\
**Category:** support\
**Created:** [February 17, 2023, 11:50pm UTC](https://discourse.gohugo.io/t/how-to-organize-static-and-asset-files-from-the-same-npm-package/43014 "2023-02-17T23:50:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![will](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/will/32/18403_2.png) [@will](https://discourse.gohugo.io/u/will)\
**Post date:** [February 17, 2023, 11:50pm UTC](https://discourse.gohugo.io/t/how-to-organize-static-and-asset-files-from-the-same-npm-package/43014/1 "2023-02-17T23:50:32Z")

</div>

NPM package “bootstrap-icons” has both `.woff` and `.css` files. `.woff` files must go in `static/`, and `.css` files must go in `assets/` (for fingerprinting). This means I can’t `npm install` into one place; I have to manually copy the files into the right places, probably with some custom script.

Is there a better way to handle this? How do people normally handle NPM packages like this? I’d really like to be able to `npm install` and not think about it.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [February 19, 2023, 4:50am UTC](https://discourse.gohugo.io/t/how-to-organize-static-and-asset-files-from-the-same-npm-package/43014/2 "2023-02-19T04:50:05Z")

</div>

Assuming you start with `npm i bootstrap-icons`…

#### Step 1 - Mount the bootstrap fonts folder to static/fonts/

config.toml

```auto
[[module.mounts]]
source = 'static'
target = 'static'

[[module.mounts]]
source = 'node_modules/bootstrap-icons/font/fonts'
target = 'static/fonts'

```

#### Step 2 - Import the bootstrap scss file as a Sass module

assets/sass/main.scss

```css
@use "../../node_modules/bootstrap-icons/font/bootstrap-icons.scss";

```

#### Step 3 - Transpile Sass to CSS using the [Dart Sass transpiler](https://discourse.gohugo.io/t/using-the-dart-sass-transpiler/41878)

layouts/\_default/baseof.html

```auto
{{ $opts := dict "targetPath" "style.css" "transpiler" "dartsass" }}
{{ with resources.Get "sass/main.scss" | toCSS $opts | minify | fingerprint }}
  <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{ end }}

```

#### N.B. This will fail if you use the Libsass transpiler. Been there, done that.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [February 22, 2023, 1:22am UTC](https://discourse.gohugo.io/t/how-to-organize-static-and-asset-files-from-the-same-npm-package/43014/3 "2023-02-22T01:22:59Z")

</div>

Closed on February 22, 2023, 1:22am UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
