Adding custom.css to Hugo Modules

When modifying a theme imported as a Hugo Module, sometimes they come with easy-to-overwrite custom.css files (Ex: poison/assets/css/custom.css at master · lukeorth/poison). Even if they don’t, when I import as a submodule, I can generally edit the theme files directly to add some custom CSS (although not ideal).

I was wondering what the best practices are for modifying themes imported as Hugo Modules without such files, ideally avoiding creating a complete copy of the theme’s layout folder.

It does not depend on the way you import the code.

Best practice is, to copy the files you want to modify to the same location in your site.
Modify it there, enhance, change , add whatever. Don’t change the files in a theme directly.

You should go with this also when using submodules or clone.

Hugo will use your local copy first and skip the theme one.

you could - if you dig in - for example change the code that’s adding the css. implementing a similar approach than poison (or other).

To get the sources of a module, just vendor the module - implement using the approach from above. Then you have access to the files in the vendor folder. (

  • copy the ones you need to your site and adjust.
  • if you don’t want the vendored stuff in your repo, add them to your to .gitignore

more details here: hugo mod vendor and Use Hugo Modules

other ways:

  • clone it somewhere as a source
  • find it in the hugo cache