Unexpected mount behaviour

I want to use npm to serve video using vidstack. So that the js and css files can be accessed from the deployed site, and based on a suggestion in this post, I’ve included the following in my config.toml file:

source = “node_modules/vidstack/”
target = “static/vidstack/”

The effect of this, however, is that on deployment the only subfolder of ‘static’ that hugo includes is the ‘vidstack’ subfolder. Anything else in static is deleted. Surely this isn’t what mounting content is supposed to produce?

Yes it is (if I understand you correctly), but I can understand the question.

When I added the mount configuration I was careful to avoid breking existing sites, so if you have not configured a static mount, we add the default static folder, but, as in your example, we expect that you configure the static mounts that you want.

I assume that you want something ala:

source = “static”
target = “static”
source = “node_modules/vidstack”
target = “static/vidstack”

1 Like

That solved it. It wasn’t obvious to me from what must have been an excessively cursory reading of the docs that mounting to one of the permitted folders is an all-or-nothing thing. But I now understand better how it works. Thanks.

Having said that, one aspect I don’t understand is why, despite having included node-modules in my .gitignore file, meaning that it and its contents arent in the Github repository at all, the site still deploys (to Cloudflare, in this instance) correctly with the vidstack folder correctly included under the root together with the rest of the static folders.

The thing is, without that behaviour it wouldn’t be possible to ignore the root static (or content e.g.) folder. I thought long and hard about this back then, and I thought a little confusion would be better than the alternative.


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