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

Synchronous run of postcss-custom-properties leads to unexpected results #132

Closed
3 tasks done
Antonio-Laguna opened this issue Jan 7, 2022 · 0 comments · Fixed by #133
Closed
3 tasks done

Synchronous run of postcss-custom-properties leads to unexpected results #132

Antonio-Laguna opened this issue Jan 7, 2022 · 0 comments · Fixed by #133

Comments

@Antonio-Laguna
Copy link
Member

Bug description

Introduced here: postcss/postcss-custom-properties#181

Most of the time canReturnSyncFunction is true and this leads to vars in other places not being properly transformed, this is especially dangerous when combined with postcss-import.

Source CSS

/* util/an-import.css */
:root {
    --foo: red;
}
/* Another file */
@import './util/an-import.css';

.foo {
    color: var(--foo);
}

Expected CSS

:root {
    --foo: red;
}

.foo {
    color: red;
    color: var(--foo);
}

Actual CSS

:root {
    --foo: red;
}

.foo {
    color: var(--foo);
}

Does it happen with npx @csstools/csstools-cli <plugin-name> minimal-example.css?

No response

Extra config

This needs to happen on external files

What plugin are you experiencing this issue on?

PostCSS Custom Properties

Plugin version

12.0.2

What OS are you experiencing this on?

macOS

Node Version

14.17.3

Validations

  • Follow our Code of Conduct
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Would you like to open a PR for this bug?

  • I'm willing to open a PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant