Skip to content

postcss-preset-env behaves differently than in the "interactive playground" #1041

Closed
@diesieben07

Description

@diesieben07

Bug description

postcss-preset-env behaves different when I use it locally compared to the interactive playground, specifically in terns of the custom-properties feature.
I want to explicitly support only browsers that already support this feature. Therefor I set my browserslist configuration as defaults and supports css-variables.
In the interactive playground this has the desired effect and custom properties are not transformed (see here).

Locally however, with the exact same postcss.config.mjs file, they are replaced, seen in this repository.

Source CSS

body {
    --color: red;
    color: var(--color);
}

Expected CSS

body {
    --color: red;
    color: var(--color);
}

Actual CSS

body {
    --color: red;
    color: red;
    color: var(--color);
}

Debug output

⚠  Using features from Stage 2 (default)
  prefers-color-scheme-query has been disabled by "enableClientSidePolyfills: false".
  custom-selectors with stage 1 has been disabled
  focus-visible-pseudo-class has been disabled by "enableClientSidePolyfills: false".
  focus-within-pseudo-class has been disabled by "enableClientSidePolyfills: false".
  blank-pseudo-class has been disabled by "enableClientSidePolyfills: false".
  has-pseudo-class has been disabled by "enableClientSidePolyfills: false".
Disabling :is on "nesting-rules" due to lack of browser support.
Adding area[href] fallbacks for ":any-link" support in Edge and IE.
Enabling the following feature(s):
  all-property
  any-link-pseudo-class
  autoprefixer
  break-properties
  cascade-layers
  case-insensitive-attributes
  clamp
  color-function
  color-functional-notation
  color-mix
  custom-media-queries
  custom-properties
  dir-pseudo-class
  display-two-values
  double-position-gradients
  float-clear-logical-values
  font-format-keywords
  font-variant-property
  gap-properties
  gradients-interpolation-method
  hexadecimal-alpha-notation
  hwb-function
  ic-unit
  image-set-function
  is-pseudo-class
  lab-function
  logical-properties-and-values
  logical-resize
  logical-viewport-units
  media-queries-aspect-ratio-number-values
  media-query-ranges
  nested-calc
  nesting-rules
  not-pseudo-class
  oklab-function
  opacity-percentage
  overflow-property
  overflow-wrap-property
  place-properties
  rebeccapurple-color
  relative-color-syntax
  scope-pseudo-class
  stepped-value-functions
  system-ui-font-family
  text-decoration-shorthand
  trigonometric-functions
  unset-value [postcss-preset-env]

Extra config

No response

What plugin are you experiencing this issue on?

PostCSS Preset Env

Plugin version

9.0.0

What OS are you experiencing this on?

Linux

Node Version

18.16.1

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions