Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

importFrom priority #215

Closed
Closed

Description

@reme3d2y

Thank you for this great plugin.

I want to override custom properties used in a third-party library.
I tried to do that with importFrom. But I was surprised to see that the variables were not overridden.

Inside this library, one of the components contains the following css rules:

:root {
    --border-radius: 4px;
}

.component {
    border-radius: var(--border-radius);
}

I configure the following options:

importFrom: [{
    customProperties: { '--border-radius': '100px' }.
}]

I expect the border-radius to be 100px.
But it remains 4px.


In source code I saw that variables from root have priority over variables from importFrom. Is this correct behavior?

In my opinion, the variables from importFrom should have the maximum priority.

I think those lines should be switched:
https://github.com/postcss/postcss-custom-properties/blob/master/src/index.js#L31
https://github.com/postcss/postcss-custom-properties/blob/master/src/index.js#L32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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