To use the new postCSS resource feature in Hugo 0.43, you must have postcss-cli installed on your path. However, ideally, it should be enough to install it into node_modules/.bin/. That way your project can document all its requirements in a project specific package.json and not need a separate global install. It also eases dealing with multiple projects with different versions of postcss-cli in use.
Local install of postcss-cli is still not working. I get the following error unless I install postcss-cli globally.
Building sites … ERROR 2018/08/05 17:46:48 error: failed to transform resource: POSTCSS: failed to transform "css/tachyons.css" (text/css): this feature is not available in your current Hugo version
I have postcss in my node_modules/.bin/ and node_modules/postcss-cli/bin/
This is my html
{{ $style := resources.Get "css/tachyons.css" | resources.PostCSS }}
You need to reopen this issue.
@numbfall Please be sure you are using Hugo v0.45 or newer -- that was when the fix was added.
I think it would be useful to have this functionality for themes, too. I.e. Hugo using postcss-cli and any plugins contained in themes/sometheme/node_modules/.bin. This way a theme's dependencies could be installed more easily. Or am I being silly?
@TheBaronHimself
We had this discussion. See https://github.com/gohugoio/hugoThemes/issues/396
In short theme authors should commit the /resources directory so that a theme can be used by someone who is on the Hugo basic version.
@onedrawingperday
That makes lots of sense, actually. Thanks.
Local postcss-cli seems to work on Mac, but doesn't on Windows. Can we reopen?
Most helpful comment
Local
postcss-cliseems to work on Mac, but doesn't on Windows. Can we reopen?