HUGO

Is it possible to [[module.imports]] a "simple" Internet folder?

I’m trying to wrap a module for ionicon.

It works fine for the css/font part (modules are really best thing since they invented sliced bread)*.

But I have to reference external scripts that are (unfortunatelly) not given with the ionicon repository.

They are provided by https://unpkg.com/ionicons/dist/ionicons/, but this does not works when I want to module.imports it (Hugo 0.77.0)

[[module.imports]]
path = "unpkg.com/browse/ionicons/dist/ionicons/"
[[module.imports.mounts]]
source = "/"
target = "static/js"

Is there a way to achieve this : Using this external folder, not on GitHub with modules, so my module could be self sufficient ?

https://unpkg.com/browse/ionicons/dist/ionicons/ is readable but the error is:

Error: module "unpkg.com/browse/ionicons/dist/ionicons/" not found; 
either add it as a Hugo Module or store it in "/Users/myname/Documents/Git/lachotte-agico/themes".: module does not exist

Yeah, sorry, but I think there is no such thing as a “simple internet folder”. It might be an FTP directory, or a Windows Folder, or some kind of SSH directory, but they all need a certain specific type of connection and are not just magically mounted folders.

In this specific case you could create your own module for https://github.com/ionic-team/ionicons. The problem I am seeing is that the dist folder does not exist in the Git repo, you would have to run npm run build to create the files in dist.

By the way, @bep said some days ago a file can be mounted… did you try that? Maybe that’s possible for your use-case. Mount all the files directly instead of a folder.

yeah. Thanks.

I’m doing my own module.
Works fine for the github ionicon.
But it relies on a CDN script, and I don’t want to track version by hand (will be my workaround at the end) and embeded it.

I will look for npm if it can solve this.
.
The root of the problem is that https://unpkg.com/ionicons/dist/ionicons/ is not recognised (in my setup) to be mounted.

Hense i can’t mount a single file belonging to this folder.

hmm, why not creating an npm script that compiles the dist folder and commits it to your module? This way you would “just” have to run some kind of “npm run release” script whenever there is an update.

Yes. Will look for it I’m noob in npm (yeah in this, too :slight_smile:

And may be the “proxy” option can be on some help, but I can’t understand how this option works just by looking at the doc.