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

@extend outer selector from within @media should error via @content #1923

Closed
bra-kodairakenya opened this issue Feb 19, 2016 · 6 comments
Closed

Comments

@bra-kodairakenya
Copy link

Note: this sample should error but does not so currently:

%btnBase {
  display: none;
}

@mixin mobile {
  @media only screen and (min-width:300px) {
    @content;
  }
}

@include mobile {
  a {
    @extend %btnBase;
  }
}

Sorry!!!
I have poor English.

Look so described the problem under.

%btnBase {
  display: none;
}

// Scope error
@media only screen and (min-width:300px) {
  a {
    @extend %btnBase;
  }
}

@mixin mobile {
  @media only screen and (min-width:300px) {
    @content;
  }
}

// Why Success??
@include mobile {
  a {
    @extend %btnBase;
  }
}
@xzyfer
Copy link
Contributor

xzyfer commented Feb 19, 2016

This should error. The success is a bug. You can't @extend %foo inside
@media if %foo is defined outside the @media.
On Feb 19, 2016 2:33 PM, "kenyanke" [email protected] wrote:

Sorry!!!
I have poor English.

Look so described the problem under.

%btnBase {
display: none;
}

// Scope error
@media only screen and (min-width:300px) {
a {
@extend %btnBase;
}
}

@mixin mobile {
@media only screen and (min-width:300px) {
@content;
}
}

// Why Success??
@include mobile {
a {
@extend %btnBase;
}
}


Reply to this email directly or view it on GitHub
#1923.

@bra-kodairakenya
Copy link
Author

@xzyfer
Thanks!
I know, right.

However , this program would succeed.

%btnBase {
  display: none;
}

@mixin mobile {
  @media only screen and (min-width:300px) {
    @content;
  }
}

@include mobile {
  a {
    @extend %btnBase;
  }
}

I want you to try to reproduce how.

@mgreter
Copy link
Contributor

mgreter commented Feb 23, 2016

Closing since I simply don't know what the expected result for the second example should be: @kenyakodaira please provide a concise input example and the expected output. Feel free to re-open once you have provided the requested standalone input example and its expected output. Thanks!

@mgreter mgreter closed this as completed Feb 23, 2016
@chriseppstein
Copy link
Contributor

@mgreter the example above errors in ruby sass but succeeds in libsass. The expected result is an error message is something like:

Error: You may not @extend an outer selector from within @media.
       You may only @extend selectors within the same directive.
       From "@extend %btnBase" on line 13.
        on line 1 of standard input

@chriseppstein chriseppstein reopened this Feb 24, 2016
@bra-kodairakenya
Copy link
Author

@chriseppstein
I have also wants the same result.

@mgreter
Copy link
Contributor

mgreter commented Apr 5, 2016

Pretty sure that this is closely related to #1927

@mgreter mgreter changed the title Why scope success? @extend outer selector from within @media should error via @content Apr 5, 2016
@mgreter mgreter added this to the 3.4 milestone Apr 5, 2016
@mgreter mgreter modified the milestones: 3.3.5, 3.4 Apr 17, 2016
@mgreter mgreter self-assigned this Apr 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants