Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with nested media queries #6

Open
spacedawwwg opened this issue May 30, 2019 · 6 comments
Open

Not working with nested media queries #6

spacedawwwg opened this issue May 30, 2019 · 6 comments

Comments

@spacedawwwg
Copy link

Using postcss-extend-rule and postcss-nesting together but coming across an issue where @extend definitions nested media queries are being stripped.

.foo {
    color: red
}

.bar {
    color: blue;

    @media (min-width: 768px) {
        @extend .red;
    }
}

I would expect

.foo {
    color: red
}

.bar {
    color: blue;
}

@media (min-width: 768px) {
    .bar {
        color: red;
    }
}
@edward-simpson
Copy link

I am also experiencing this issue:

%font--gillsans-medium {
    font-family: 'GillSansMTStd-Medium', sans-serif;
}

.navigation {
    &__link {
        @postcss-extend %font--mrseaves-roman;
        
        @media (--from-tablet) {
            @postcss-extend %font--gillsans-medium;
            // Other CSS rules here
        }
    }
}

The override font extension is being stripped out from inside the media query, however all the other CSS rules, including mixins, are working correctly

@jonathantneal
Copy link
Collaborator

Yes, I noticed this bug, and I don’t like it either. I think the plugin should be re-written to accept the context of the rule being extended.

@aacoelho
Copy link

I'm having the same problem, did anyone find a way to overcome this?

@edward-simpson
Copy link

Only way I found was to stop using postcss-extend (moved my font declarations into mixins)

@nisancigokmen
Copy link

Thank you, I would also like to voluntarily participate in the organization and provide assistance :) have a good work.

@42tte
Copy link

42tte commented Nov 28, 2023

Works on my machine™ I have postcss-extend-rule come before postcss-nested & postcss-custom-media

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants