Created
December 5, 2013 23:03
-
-
Save pdaoust/7815628 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains 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.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
// Filter items from a list. Each function takes an item (and additional | |
// arguments) and returns a boolean value indicating whether the item passed the | |
// filter. | |
@function f-filter($func, $list, $args...) { | |
$new-list: (); | |
@each $item in $list { | |
@if call($func, $item, $args...) { | |
$new-list: append($new-list, $item); | |
} | |
} | |
@return $new-list; | |
} | |
@function is-angular-unit($x) { | |
@return not not index(deg rad grad turn, unit($x)); | |
} | |
p { | |
is-degrees-angular: is-angular-unit(3deg); | |
is-ems-angular: is-angular-unit(24em); | |
// And a functional filter. | |
angular-values: f-filter(is-angular-unit, (1px 24em 3deg 64grad 7 2.5turn)); | |
} |
This file contains 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
p { | |
is-degrees-angular: true; | |
is-ems-angular: false; | |
angular-values: 3deg 64grad 2.5turn; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment