hugomods / icons

:art: Hugo SVG Icons Module that compatible any SVG image vendors, i.e. Bootstrap, Font Awesome, Simple Icons.
https://icons.hugomods.com
MIT License
12 stars 3 forks source link

"Need at least one mount" when trying to vendor fontawesome #303

Closed peacememories closed 9 months ago

peacememories commented 9 months ago

Hi, and thanks for creating this hugo module :)

I've run into a problem when using github.com/hugomods/icons/vendors/font-awesome as a module. My build system (nix) does not allow downloading anything during a build, so the dependencies need to be vendored. But when I use hugo mod vendor, I get the following error:

Error: cannot vendor module "github.com/hugomods/font-awesome", need at least one mount

This also happens when I manually put this in my hugo.toml

[module]
[[module.imports]]
    path = 'github.com/hugomods/font-awesome'
[[module.imports.mounts]]
    source = "svg/brands"
    target = "assets/icons/font-awesome-brands"
[[module.imports.mounts]]
    source = "svg/solid"
    target = "assets/icons/font-awesome-solid"
[[module.imports]]
    path = 'github.com/hugomods/icons'

I also found that this seems to be a more common problem with Hugo/Go (see https://github.com/gohugoio/hugo/issues/10123)

I'm unsure how to work around this since I am not very familiar with Go module internals. Is there a way to create a mount that makes hugo mod vendor happy?

razonyang commented 9 months ago

Yeah, that's a known issue about vendoring modules, perhaps we can make a dummy mounting to skip this limit, but I'm not sure.

razonyang commented 9 months ago

Add a dummy mounting folder, should work now.

Please upgrade to latest version and vendor again, you'll need to remove the _vendor folder first.

image

razonyang commented 9 months ago

There maybe other modules without mountable folders, please open an issue on related repo if you need it.

peacememories commented 9 months ago

hugo mod vendor works like a charm now, thanks :) Still can't get it to work with Nix' buildGoModule (probably because I'm configuring it wrong), but the in-source vendoring allows me to use the module so this is fine for now :)