schnerring / hugo-theme-gruvbox

A retro-looking Hugo theme inspired by gruvbox. The pastel colors are high contrast, easily distinguishable, pleasing to the eye, and feature light and dark color palettes.
MIT License
157 stars 39 forks source link

prism modules aren't loaded correctly when using subdirectory #281

Open Valhrafnaz opened 6 days ago

Valhrafnaz commented 6 days ago

I host my blog at a sub-directory of my overall site, but sadly the theme seems to have misconfigured paths, as adding a subfolder to my baseURL causes the build process to fail thusly:

Error: error building site: POSTCSS: failed to transform "css/non-critical.css" (text/css): CssSyntaxError: postcss-import: /home/valhrafnaz/blog-server/stdin:13:5: Failed to find 'blog/prismjs/plugins/toolbar/prism-toolbar.css'
  in [
    /home/valhrafnaz/blog-server,
    /home/valhrafnaz/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/schnerring/hugo-theme-gruvbox@v0.0.0-20240621140605-37cea91b04c5/assets/css
  ]

  11 |     
  12 |     /* Import stylesheet for Prism plugin 'toolbar' from 'blog/prismjs/plugins/toolbar/prism-toolbar.css' */
> 13 |     @import "blog/prismjs/plugins/toolbar/prism-toolbar.css";
     |     ^
  14 |   
  15 | 

I assume this is caused by using the absolute path rather than the relative path to load the plugins. Removing the /blog from my baseURL causes the build to go without a hitch, but this of course breaks all links since they now missing the sub-directory.

schnerring commented 4 days ago

Have you looked at the hugo -s CLI argument?

-s, --source string              filesystem path to read files relative from

I think you need to run hugo -s blog/

See: