From the official documentation for function resources.PostCSS
:
Options
config [string]
Set a custom directory to look for a config file
I define a custom directory as option:
{{ with ( resources.Get "test.scss" ) | postCSS (dict "config" "mydir/" ) }}
and it correctly picks up postcss.config.js
from mydir
. So far so good.
Documentation also tells:
The resource will be processed using the project’s or theme’s
own postcss.config.js or any file set with the config option.
This makes me think I can specify a file as value in the config
option. So I try with:
{{ with ( resources.Get "test.scss" ) | postCSS (dict "config" "mydir/mypostcss.config.js" ) }}
This doesn’t thow an error, but doesn’t pick up mypostcss.config.js
either.
Can I specify both a directory and a file with the config
option?
hugo
’s error message when specifying an invalid file/path isn’t really helpful here:
POSTCSS: failed to transform "a.scss" (text/x-scss): postcss config "path" not found:
Side note: I consider the config
option somehow unfortunate, would be better to have a configDir
(or a configFile
) option here. But that ship has probably sailed already!?