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

Media queries and @extend with sass functions #2341

Closed
kenjiqq opened this issue Feb 24, 2017 · 0 comments
Closed

Media queries and @extend with sass functions #2341

kenjiqq opened this issue Feb 24, 2017 · 0 comments

Comments

@kenjiqq
Copy link

kenjiqq commented Feb 24, 2017

I discovered a strange bug with extending and media queries when using a function to calculate the media query value.

The following code produces an error with libsass using both node-sass and sassc but works fine using ruby sass.

@function aFunction() {
    @return 1em;
}

@media (max-width: 1em) {
    %placeholder {
        color: red;
    }
}

@media (max-width: aFunction()) {
    .test {
        @extend %placeholder;
    }
}
Error: You may not @extend an outer selector from within @media.
       You may only @extend selectors within the same directive.
       From "@extend %placeholder" on line 13 of ../../privateonline/test.scss
        on line 6 of ../../privateonline/test.scss
>>     %placeholder {
   ----^

Ruby sass generates the expected css

@media (max-width: 1em) {
  .test {
    color: red; } }

And replacing the function call with the value makes libsass compile correct as well

@media (max-width: 1am) {
    .test {
        @extend %placeholder;
    }
}

version info:

./sassc --version
sassc: 3.4.1-3-g36eb
libsass: 3.5.0.beta.3-2-g58fa
sass2scss: 1.1.0
sass: 3.5

node-sass --version
node-sass	4.5.0	(Wrapper)	[JavaScript]
libsass  	3.5.0.beta.2	(Sass Compiler)	[C/C++]

sass --version
Sass 3.4.23 (Selective Steve)
mgreter added a commit to mgreter/sass-spec that referenced this issue Feb 24, 2017
@mgreter mgreter self-assigned this Feb 24, 2017
mgreter added a commit to mgreter/libsass that referenced this issue Feb 24, 2017
mgreter added a commit to mgreter/libsass that referenced this issue Feb 25, 2017
@xzyfer xzyfer added this to the 3.5.0.beta.4 milestone Feb 27, 2017
xzyfer added a commit to xzyfer/sass-spec that referenced this issue Apr 23, 2017
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

3 participants