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.
Thanks!