MadLittleMods / postcss-increase-specificity

Why? Dealing with CSS you can't remove(mainly from a 3rd party). Increases specificity of selectors.
MIT License
50 stars 16 forks source link

Custom animations #7

Closed jondlm closed 6 years ago

jondlm commented 7 years ago

Rather than do a big explanation, I'll give you a new failing test case:

it('should work with custom animations', function() {
    return testPlugin('./test/fixtures/custom-animation.css', './test/fixtures/custom-animation.expected.css');
});

custom-animation.css

@keyframes my-animation {
    from {
        background-color: red;
    }

    to {
        background-color: yellow;
    }
}

.my-class {
    animation: my-animation 1s;
}

custom-animation.expected.css

@keyframes my-animation {
    from {
        background-color: red;
    }

    to {
        background-color: yellow;
    }
}

:root:root:root .my-class {
    animation: my-animation 1s;
}

I don't think it should be adding :root inside the @keyframe section.

Thanks! // Jon

MadLittleMods commented 7 years ago

@jondlm Adding the actual output would help me understand the issue easier.

Feel free to submit a PR

laucheukhim commented 7 years ago

@MadLittleMods This plugin wrongly prepends :root:root:root to animation declarations:

@keyframes my-animation {
    :root:root:root from {
        background-color: red;
    }

    :root:root:root to {
        background-color: yellow;
    }
}

This breaks all custom animations.

MadLittleMods commented 7 years ago

@laucheukhim 😢 Feel free to submit a PR to filter the rule if it is a @keyframes at-rule, https://github.com/MadLittleMods/postcss-increase-specificity/blob/cf8cad46f38942d5e5f4bc5e79338ef5c3975289/index.js#L21

jondlm commented 6 years ago

Looks like this was fixed with #14

MadLittleMods commented 6 years ago

Thanks for following up @jondlm. It looks like this issue wasn't closed because the PR was technically closed