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

postcss-custom-properties: <css input> Unknown word #5310

Closed
abhisheksoni27 opened this issue Aug 27, 2021 · 3 comments
Closed

postcss-custom-properties: <css input> Unknown word #5310

abhisheksoni27 opened this issue Aug 27, 2021 · 3 comments

Comments

@abhisheksoni27
Copy link

What version of Tailwind CSS are you using?

2.2.7

What build tool (or framework if it abstracts the build tool) are you using?

nuxt ^2.15.7

What version of Node.js are you using?

v14.17.0

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction repository

https://github.com/abhisheksoni27/tailwindcss-custom-properties-bug

Describe your issue

Simple CSS variables are not working. postcss-custom-properties complains about an unknown word. Check https://github.com/abhisheksoni27/tailwindcss-custom-properties-bug/blob/main/assets/css/root.css

Here's the error:

Screenshot 2021-08-27 at 8 53 06 AM

@bradlc
Copy link
Contributor

bradlc commented Aug 27, 2021

Hey @abhisheksoni27. This is not an issue with tailwindcss itself, as the issue persists even after removing the tailwindcss PostCSS plugin. This seems to be related to an issue with @nuxt/postcss8 that causes cssnano to run before other PostCSS plugins, when really it should run last. Here are some relevant issues over on the @nuxtjs/tailwindcss repo:

And here is my pull request that should fix the issue with @nuxt/postcss8: nuxt/postcss8#19

A workaround that you could use for now would be to force cssnano to run last, using the build.postcss.order option in your Nuxt config:

export default {
  /* ... */
  build: {
    postcss: {
      order: 'cssnanoLast'
    }
  }
}

Hope that helps!

@bradlc bradlc closed this as completed Aug 27, 2021
@abhisheksoni27
Copy link
Author

@bradlc Thanks a lot for the information, and for providing that PR. Adding the clause in nuxt.config.js fixed the issue for now 👍🏻

@dangh
Copy link

dangh commented Dec 5, 2024

If someone using nuxt 2 still seeing this error, the root cause is postcss-custom-properties@11 use postcss-values-parser@4 which can't parse *var() without space between * and var. It was fixed in postcss-values-parser@6.0.2. See shellscape/postcss-values-parser#138

A workaround is using overrides to force using newer version of postcss-values-parser:

{
  "overrides": {
    "postcss-custom-properties": {
      "postcss-values-parser": "^6.0.2"
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants