Trouble setting custom assetDir name & path

I am trying to set a custom assetDir instead of the default assets I’d like to use src. The short of it is I have been using Gulp to run tasks for me and I use the src as my naming convention. I’d like to start taking more advantage of Hugo’s sass watching / compilation, moving away tasks out of Gulp where I can…
I want to change the default asset directory via assetDir in my config.toml file like so:
assetDir = "src"

Now, if I run hugo config to print out my settings, I see that the change has taken hold. However, when I run hugo server essentially I get this (I’ve edited down the output):

Error: Error building site: failed to render pages: render of "page" failed: "/my-project/themes/blank/layouts/_default/single.html:2:22": execute of template failed: template: _default/single.html:2:3: executing "_default/single.html" at <partial "header.html...>: error calling partial: "/my-project/themes/blank/layouts/partials/header.html:2:22": execute of template failed: template: partials/header.html:2:22: executing "partials/header.html" at <resources.Get>: error calling Get: stat /my-project/themes/blank/assets/sass/main.scss: no such file or directory

At this point, the exercise is mostly academic b/c I just changed the name of the directory, and now Hugo will watch and compile my sass:

{{ $options := ( dict "targetPath" "css/root.css" "outputStyle" "compressed" "enableSourceMap" true ) }} {{ $style := resources.Get "sass/root.scss" | resources.ToCSS $options }}

That said, I’d still like to get to the bottom of why changing the config setting does not work.


Can you share your site code?

Thanks for your help, here are some links to the branch in my github repo:

here is the config.toml file:

and here is the relevant partial:

Feel free to look about the repo if you need more, its all a big work in progress / learning project and presently the dev site broken as all get out, but for different reasons…

Thanks again!

I was able to replicate your issue on Windows 10 with Hugo 0.54.0

Weirdly, when I moved the src folder from themes/blank/src to your site root, the site built fine. So this feels like a bug

1 Like

If you would, please create an issue here @ricardoom

@zwbetz thanks for your help, looks like the functionality you experienced is by design. See this github issue:

The way I understand it, if I am to rename or call a different directory, it must indeed be placed in the project root, and not in the theme…

I’m going to close this and mark it as solved.

Ah, good to know.