Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to specify multiple plugins in the PostCSS options map #9015

Closed
jmooring opened this issue Oct 9, 2021 · 1 comment · Fixed by #9016
Closed

Unable to specify multiple plugins in the PostCSS options map #9015

jmooring opened this issue Oct 9, 2021 · 1 comment · Fixed by #9016
Labels

Comments

@jmooring
Copy link
Member

jmooring commented Oct 9, 2021

Our PostCSS options documentation states:

use [string]
List of PostCSS plugins to use

Currently you can only specify a single plugin:

  • The use element of the options map will not accept a slice of plugins; it expects a string
  • If you specify a list of plugins as you would using the postcss-cli, it treats the list as a single string

For example, neither of these work:

{{ $css := resources.Get "css/main.css" | postCSS (dict "use" (slice "autoprefixer" "postcss-color-alpha")) }}
{{ $css := resources.Get "css/main.css" | postCSS (dict "use" "autoprefixer postcss-color-alpha") }}

You can work around this by (a) creating a postcss configuration file, or (b) creating a postcss object within the project's package.json file.

But for simple setups, with just a few plugins using default plugin options, specifying the plugins inline is simpler.

Ref: https://discourse.gohugo.io/t/how-to-list-postcss-plugins-to-use/31293

jmooring added a commit to jmooring/hugo that referenced this issue Oct 9, 2021
Usage:
{{ $options := dict "use" "autoprefixer postcss-color-alpha" }}
{{ $style := resources.Get "main.css" | resources.PostCSS $options }}

Fixes gohugoio#9015
jmooring added a commit to jmooring/hugo that referenced this issue Oct 9, 2021
Usage:
{{ $options := dict "use" "autoprefixer postcss-color-alpha" }}
{{ $style := resources.Get "main.css" | resources.PostCSS $options }}

Fixes gohugoio#9015
@bep bep closed this as completed in #9016 Oct 10, 2021
bep pushed a commit that referenced this issue Oct 10, 2021
Usage:
{{ $options := dict "use" "autoprefixer postcss-color-alpha" }}
{{ $style := resources.Get "main.css" | resources.PostCSS $options }}

Fixes #9015
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant