Last active
March 7, 2019 15:06
-
-
Save scottkellum/57fd435cb7c894a7c854 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.2.19) | |
// Compass (v0.12.7) | |
// ---- | |
@function linear-gradient($parameters...) { | |
$return: linear-gradient; | |
@each $parameter in $parameters { | |
$return: append($return,$parameter, comma); | |
} | |
@return $return; | |
} | |
@mixin background-image($parameters) { | |
@if nth($parameters,1) == linear-gradient { | |
$webkit-return: (); | |
@if nth(nth($parameters,2),1) == to { | |
@for $i from 3 through length($parameters) { | |
$webkit-return: append(nth($parameters,$i),$webkit-return, comma); | |
} | |
} | |
@if nth(nth($parameters,2),2) == right { | |
$webkit-return: append(left,$webkit-return, comma); | |
} | |
background-image: unquote('-webkit-linear-gradient(' + $webkit-return + ')'); | |
$standard-return: (); | |
@for $i from 2 through length($parameters) { | |
$standard-return: append($standard-return,nth($parameters,$i), comma); | |
} | |
background-image: unquote('linear-gradient(' + $standard-return + ')'); | |
} | |
@else { | |
background-image: $parameters; | |
} | |
} | |
foo { | |
@include background-image(linear-gradient(to right, red, green)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo { | |
background-image: -webkit-linear-gradient(left, green, red); | |
background-image: linear-gradient(to right, red, green); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment