MadLittleMods / postcss-css-variables

PostCSS plugin to transform CSS Custom Properties(CSS variables) syntax into a static representation
https://madlittlemods.github.io/postcss-css-variables/playground/
Other
540 stars 62 forks source link

CSS variable declarations in media queries produce duplicate nested output #64

Closed jhildenbiddle closed 6 years ago

jhildenbiddle commented 6 years ago

Input:

@media screen and (min-width: 480px) {
    :root {
        --color: blue;
    }

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

Expected:

@media screen and (min-width: 480px) {
    body {
        background: blue;
    }
}

Actual output:

@media screen and (min-width: 480px) {

    body {
        background: blue;
    }

    @media screen and (min-width: 480px) {

        body {
        background: blue;
        }
    }
}

Reproducible using postcss-css-variables Playground.

nolimit-developers commented 6 years ago

Hello, @jhildenbiddle , will try this plugin https://github.com/hail2u/node-css-mqpacker :) It would be best if the css input was written in OOCSS.

MadLittleMods commented 6 years ago

Closing in favor of https://github.com/MadLittleMods/postcss-css-variables/issues/67