Module import: no mounted folder, no errors

I feel like I’m missing something obvious here if someone can help.

I’m trying to use a module and mount assets the way it’s supposed to, in my case GitHub - gohugoio/hugo-mod-bootstrap-scss: Packages Bootstrap SCSS (v4 and v5) as a Hugo Module - which should just download bootstrap sources and mount result on assets/scss

I haven’t been able to do so :smiley:

$ hugo version
hugo v0.113.0+extended linux/amd64 BuildDate=2023-07-06T15:15:58Z VendorInfo=debian:0.113.0-2
$ cat hugo.toml 
...

[module]
[[module.imports]]
path = "github.com/gohugoio/hugo-mod-bootstrap-scss/v5"
[[module.imports.mounts]]
source="assets"
target="assets/bootstrap"

My assets folder remains as it was before using the module.

$ hugo
Start building sites … 
hugo v0.113.0+extended linux/amd64 BuildDate=2023-07-06T15:15:58Z VendorInfo=debian:0.113.0-2

                   | EN  
-------------------+-----
  Pages            |  2  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     | 47  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  1  
  Cleaned          |  0  

Total in 52 ms

$ ll assets/ assets/scss/
assets/:
total 0
drwxr-xr-x 1 rkj rkj 16 Aug  2 10:58 js
drwxr-xr-x 1 rkj rkj 20 Aug  9 11:12 scss

assets/scss/:
total 4.0K
-rw-r--r-- 1 rkj rkj 3.9K Aug  9 11:12 my_style.scss

Thank you for your help :smiley:

Quick bump, not making any progress here, I’ve tried a handful of versions of hugo, and also directly with the module which should also mount its own deps into assets. I don’t manage to see the mounted folders, it seems it has no effect. Clearly there’s something wrong the way I’m doing this.

Starting with a clean/virgin site…

hugo mod init foo

hugo.toml

[module]
[[module.imports]]
path = "github.com/gohugoio/hugo-mod-bootstrap-scss/v5"

assets/scss/main.scss (NOT IN STATIC)

@import "bootstrap/bootstrap

baseof.html

<head>
  ....
  {{ with resources.Get "scss/main.scss" | toCSS }}
    <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
  {{ end }}
  ...
</head>
1 Like

ok well it does work, thank you sorry for trouble <3

One misunderstanding about the way it works, I was thinking somehow assets would be populated somewhere in the project path ala node_modules, but actually go modules for hugo dependencies are stored in hugo temp folder (defaults to /tmp/hugo_cache)

This is not super convenient for IDE but I’ll make a symlink or something.

The other mistake I made was a typo on my scss import: import "bootstrap/boo_R_strap"… so that’s why my file was not compiling :man_facepalming: - getting lost without IDE completion, fatfinger

Thank you :smiley:

We recently changed the user cache location. See https://github.com/gohugoio/hugo/releases/tag/v0.116.0.

You can vendor the module(s) with hugo mod vendor. Then see _vendor directory in root of project.

thanks very good :+1:

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