An open API service indexing awesome lists of open source software.

https://github.com/josephschmitt/custom-properties-append-vars-duplicates


https://github.com/josephschmitt/custom-properties-append-vars-duplicates

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# Duplicate Variables using `postcss-custom-properties`

I have a super simple src postcss file with two custom properties:
1. `--myColor`: Declared in a `:root` selector directly in the postcss file
2. `--myBackgroundColor`: Added via the `variables` JavaScript plugin API.

After cloning the repo, run `npm install` and then `npm run build`.

## Expected Result

Running through the `postcss-custom-properties` plugin with `preserve` and `appendVariables`
produces an output file with the `--myColor` variable preserved, and the `--myBackgroundColor`
variable appended at the end of the file.

## Actual Result

The output file correctly preserves the `--myColor` variable, but then it outputs it _again_
appended to the bottom of the file. This is wasteful, and gets especially bad in large projects
with lots of declared variables.