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
New CSS filter functions conflict with built-in Sass functions #151
Comments
Yes, I just hit this too. |
Hitting this as well. |
👍 |
Any news on this one? |
I'm currently working on |
Having this issue too. |
👍 Confirming that |
Found a workaround, you can use this function in the meantime. It should be a drop-in solution: @function grayscale($value) {
@return #{ "grayscale(" + $value + ")" };
} You can vendor prefix it, too, if you’d like: @mixin filter($properties) {
// Your vendor prefixing stuff here, I am using Bourbon:
@include prefixer(filter, $properties, webkit moz spec);
} Then, you can just write: @include filter(grayscale(100%)); |
Just putting this here for reference: |
@kennethormandy Have you found a work around for the SASS functions which take two parameters? @function darken($color, $amount) {
@return #{ "darken(" + $color + "," + $amount ")" };
}
.selector {
border: 1px solid darken(#f0f1f4, 3);
} Outputs: border: 1px solid darken(#f0f1f4,3""); …but really it shouldn’t even be outputting |
.selector {
border: 1px solid darken(#f0f1f4, 3);
} and you’ll get .selector {
border:1px solid #e7e9ee;
} I think you might (understandably) be mixing up Sass’ functions with CSS Filters. The example I gave will only work because it’s a CSS Filter. If you’re looking to use Sass’ darken or saturate, that should work already, per the Sass docs. If you want to use the CSS Filter saturate, you’re on the right track basing it off of my |
My mistake. I was nesting methods, and called |
+1 |
Is there any news on this one? Would be really nice to not obfuscate the code with the workaround provided above, although it works. |
Looking for a solution as-well =) |
+1 |
2 similar comments
+1 |
+1 |
Thanks @kennethormandy for workaround |
+1. By the way: Thanks @kennethormandy for the solution. |
CSS filter effects [0] define several functions (invert, grayscale, opacity, saturation) that collide with the names of built-in Sass functions. Overload these functions with a no-op when the filter effects function signature is discovered. This is compatible with Ruby Sass. For example, calling `invert` with a color will return an inverted color as before: color: invert(sass#333) => color: #cccccc But calling `invert` with a percentage will pass through the function call unharmed. filter: invert(30%) => filter: invert(30%) filter: invert(.03) => filter: invert(.03) Fixes sass#151. [0]: http://www.w3.org/TR/filter-effects/
Just opened (and closed) an issue about this as well. It would be nice to get this cleaned up as there is a fundamental shift of CSS to start using more and more function like syntax with overlap. Yeah @kennethormandy, thanks for the workaround idea, but when you do that, then you kill the actual |
Another workaround: instead of |
Alright, let me see if we can get this in 3.0. |
CSS filter effects [0] define several functions (invert, grayscale, opacity, saturation) that collide with the names of built-in Sass functions. Overload these functions with a no-op when the filter effects function signature is discovered. This is compatible with Ruby Sass. For example, calling `invert` with a color will return an inverted color as before: color: invert(sass#333) => color: #cccccc But calling `invert` with a percentage will pass through the function call unharmed. filter: invert(30%) => filter: invert(30%) filter: invert(.03) => filter: invert(.03) Fixes sass#151. [0]: http://www.w3.org/TR/filter-effects/
Adding test for sass/libsass#151 and pull request sass/libsass#515
CSS filter effects [0] define several functions (invert, grayscale, opacity, saturation) that collide with the names of built-in Sass functions. Overload these functions with a no-op when the filter effects function signature is discovered. This is compatible with Ruby Sass. For example, calling `invert` with a color will return an inverted color as before: color: invert(sass#333) => color: #cccccc But calling `invert` with a percentage will pass through the function call unharmed. filter: invert(30%) => filter: invert(30%) filter: invert(.03) => filter: invert(.03) Fixes sass#151. [0]: http://www.w3.org/TR/filter-effects/
Thank you @tamlyn! I've been using Scout.app, which is apparently still on an old version of Sass, so your workaround is a fast, simple solution that actually works. |
@restlessdesign Hi folks, I know this it very late but, I just had this issue and my workaround was to quote the filter function and then use unquote() on it. So I wrote: And the output works. |
why is this closed? the workaround is not a good solution. why can't you just change the name of the grayscale() sass function? |
The following code:
Results in the following with sass 3.2.10:
But the following with libsass master (at 4dd61de currently):
This seems to be a conflict with the built-in grayscale function.
The text was updated successfully, but these errors were encountered: