Simplest/cleanest way to install and include npm modules in hugo?

Has anyone got a good pattern for dropping in modules into hugo via npm? I have been using some manually inclusions in some layouts/partials/head-custom-pre.html (pre to avoid over-riding existing stuff) but this is not great.

Seems like a webpack build with a mock app might do it but that is not great either.

1 Like

I use some npm scripts to get modules from node_modules in my project. So I went completely away from Gulp or Webpack and just use the Hugo assets pipeline. If interested I can post the scripts as Gists.

Hope this helps.


I’d be interested actually. Looked at Hugo Pipes and they are not dogfooding so I don’t believe what they write is complete.

Basically, I am trying to understand how people are using Hugo with complex dependencies. npm install complex_thing_that_depends_on_world, is one way to pull in a bunch of dependencies, and then maybe attache it to a minify/build pipeline (for example using vue). hugo pipes seems to be claiming they can replace this but I somehow doubt it. None of the examples actually show this working AFAIK.

Where in the Hugo Pipes docs do they claim to be a total replacement for npm?

You’re welcome. Here’s the link to the repo:

The is full of info about the project and most files are well commented.

Hope this helps.


Thanks for sharing!

1 Like

I guess I meant just the build/minification step that I associate with npm, not really npm, but sounds like I misread that too.