Hugo assetDir configuration for asset bundling pipe does not work for themes

Hugo has a configuration called assetDir where Hugo finds asset files for Hugo Pipes.

I’ve set assetDir = "static" in my config.toml and it’s working fine to locate my CSS files from my static/css folder:

{{ $base := resources.Get "css/style.css" }}

The problem is to find the CSS located in the theme’s static/css folder, like:

{{ $animate := resources.Get "css/animate.css" }}

I’m getting the following error:

executing "partials/head.html" at <resources.Get>: 
  error calling Get: stat /project/themes/elate/assets/css/animate.css: 
    no such file or directory

Hugo ignores the assetDir configuration and looks in the default assets folder.

Isn’t it possible to specify the assets folder for the theme with assetDir or any other configuration?

Relevant GH issue: https://github.com/gohugoio/hugo/issues/5207

1 Like