First time using PostCSS, so sorry if it’s a silly or repeat question. I’ll keep reading docs to see if I can figure it out myself.
This worked:
<head>
...
{{ $style := .Resources.GetMatch "styles.css" | resources.Minify }}
<style>{{ $style.Content | safeCSS }}</style>
</head>
My following changes do not work.
npm i -g postcss-cli precss
<head>
...
{{ $style := .Resources.GetMatch "styles.css" | resources.PostCSS }}
{{ <style>{{ $style.Content | safeCSS }}</style> }}
</head>
// postcss.config.js at Hugo root
module.exports = {
plugins: [
require('precss')
]
}
I receive the error:
error calling Content: read /Users/dylan/Projects/portfolio-site-2/resources/_gen/assets: is a directory
If I comment out the plugins section of postcss.config.js the error goes away.
Here’s the output of {{ printf "%#v" $style }}
&resources.transformedResource{commonResource:resources.commonResource{}, cache:(*resources.ResourceCache)(0xc000271000), sourceFilename:"", linker:resources.permalinker(nil), transformation:(*postcss.postcssTransformation)(0xc000e42e40), transformInit:sync.Once{m:sync.Mutex{state:0, sema:0x0}, done:0x0}, transformErr:error(nil), publishInit:sync.Once{m:sync.Mutex{state:0, sema:0x0}, done:0x0}, published:false, content:"", contentInit:sync.Once{m:sync.Mutex{state:0, sema:0x0}, done:0x0}, transformedResourceMetadata:resources.transformedResourceMetadata{Target:"", MediaTypeV:"", MetaData:map[string]interface {}{}}, Resource:(*resources.genericResource)(0xc00021e160)}
I will be grateful for any help.