Skip to content

PostCSS Initial : unexpected behaviour for preserve option. #1564

@rubycon

Description

@rubycon

Bug description

Running PostCSS initial with preserve: false on :

{
  opacity: 1;
  pointer-events: initial;
}

will result in

{
  opacity: 1;
}

The issue is that pointer-events IS NOT amongst the properties handled by the plugin and initial is a perfectly valid value. Wouldn't the expected behaviour be that the prop is preserved as a fallback if a replacement is found, as it was the case with the original plugin replace option. With the current behaviour all properties not handled by the plugin with value initial are simply stripped!

Source CSS

{
  opacity: 1;
  pointer-events: initial;
}

Expected CSS

{
  opacity: 1;
  pointer-events: initial;
}

Actual CSS

{
  opacity: 1;
}

Playgound example

No response

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

N/A

Debug output

PostCSS Initial is not available in @csstools/csstools-cli.

Extra config

No response

What plugin are you experiencing this issue on?

PostCSS Initial

Plugin version

2.0.0

What OS are you experiencing this on?

macOS

Node Version

20

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions