HUGO

How to List PostCSS plugins to use

I have a question about how to write something that’s written in the docs, or more generally about how to use a dict. For PostCSS it says it will accept a list of plugins to use, but how is that written? In other words, dict can do Key:Value but how do you write “key:value1, value2”

My attempts have all failed. I think I don’t understand the syntax.

(I know this can be done with a js file, but please bear with me as I learn about keys and values here.)

This:

{{ $plugins := slice "autoprefixer" "postcss-preset-env" }}
{{ $options := dict "noMap" false "use" $plugins }}

Produces this data structure:

map[noMap:false use:[autoprefixer postcss-preset-env]]

Jsonifed it looks like this:

{ "noMap": false, "use": [ "autoprefixer", "postcss-preset-env" ] }

For PostCSS I’d stick with a configuration file.

1 Like

Thank you so much for taking a moment to answer my question. I do plan to stick to a config file, but this brought the question to mind and I wanted to take it as a learning opportunity. And now, thanks again, I know! :slight_smile: