-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Directives should allow interpolation #46
Comments
In selectors and normal directives, you need to use interpolation
|
Yes, this was something that popped up on my mind too. However, that doesn't work either! The error now is:
I think there is an error in the way the
|
hmm. my mistake, I guess we don't interpolate unknown at-rules. I reopened the issue. |
This is something we should support, but I don't think it's important enough to fit into 3.1. |
To me this seems to be quite important. According to #79 using the media bubbling feature currently requires repeating your selectors over and over. I'd like to do something like this instead:
|
Ah the issue is that this only works in .sass files. The SCSS parser is choking before interpolation runs. |
Just started out with SASS and immediately stumbled upon this. Not sure if I should report a separate bug for:
The error I get is
|
Just impossible to do properly dynamic responsive without this one implemented. I use this workaround in mentime :
I'd rather do
|
Another vote for this one on responsive web design grounds, please. It is very common to want a decision based on
Often, there will be several such Not being able to interpolate the length in the media query here is a significant problem, forcing repetition of those important width values throughout a SCSS file, or across a whole set of files for a larger site instead of storing all core data like that in a single file and It might be considered a different issue depending on how the parser works, but for what it's worth, I agree that it would be very nice to interpolate an entire media query as well:
For me personally this would have a much lower priority, though, because it is far less likely in practice that something like |
The following (to create the different prefixed keyframes for all browsers) is not possible either :/ @mixin animate($prefix) {
@#{$prefix}keyframes foo {
0% { color: red; }
100% { color: blue; }
}
} |
I agree too, it's a must-have behavior for responsive designs and flexible development... |
+1
|
+1 I'm trying to do:
But I get
|
this is a blocker for building proper animation and media support. |
Any plan to fix this? |
Yes. |
How soon? This is really bugging me (I'm trying to make a keyframes mixin). |
It'll be fixed in 3.2. As a work around, you can do this in a .sass file -- this bug only affects the .scss syntax |
#429 is tracking interpolation in all unknown directives. |
I'm on 3.2.1 and I tried 3.3.0.alpha.3, and i still get the bug using
|
Is it going to get fixed ? |
This has been fixed and has been working for a while. Go to http://sassmeister.com/ and try the following code: @mixin animation($animation...) {
@each $prefix in -webkit {
#{$prefix}-animation: $animation;
}
animation: $animation;
}
@mixin keyframe($name) {
@-webkit-keyframe #{$name} {
@content;
}
@keyframe #{$name} {
@content;
}
}
.foo {
@include animation(foo 30s infininte);
}
@include keyframe(foo) {
0% {
background-color: red;
}
100% {
background-color: blue;
}
} For those curious, this is the reason I only have And, of course, this works with media queries as well. Take a look at Breakpoint's usage of a full media query interpolation. Finally, for those still curious as to whether or not this is in, well, here's the official changelog about it getting in. |
I keep receiving the "Invalid CSS after "@": expected identifier, was "#{$vendor}keyfr...")" error on this code: @mixin keyframe($keyframe-name) {
$vendors: (-webkit-, -moz-, -o-, -ms-, '');
@each $vendor in $vendors {
@#{$vendor}keyframes #{$keyframe-name} {
@include keyframe-content($vendor);
}
}
} If I replace with this #{'@' + $vendor}keyframes #{$keyframe-name} { then I get this error "Invalid CSS after "": expected selector, was "@-webkit-keyfra...")" Is this going to be fixed? |
Thus, while hoping for your feature request to be implemented, you can use an if-elseif-elseif-elseif-else construct to create prefixed keyframes. |
Is this bug fixed ? I'm on 3.3.7 and I'm trying to use
and I'm getting the same error:
In sassmeister seems to work (codepen also) I tried to use both simple $ and intrepolation method #{name} but I still get the same error |
@srekoble I can't reproduce your issue. Must be a very old version of sass you're using this even works in 3.2 |
I want to create an SCSS mixin which makes me some
@-webkit-keyframe
sections. I can do the following:This works fine. However, as I want the
$name
variable to be inserted as the animation name, I replace the second line with:Sass doesn't understand this and gives a parse error:
The text was updated successfully, but these errors were encountered: