Created
August 19, 2014 05:12
-
-
Save mirisuzanne/1bde777fb07b78e34792 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.14) | |
// Compass (v1.0.0.rc.1) | |
// ---- | |
$map: ( | |
hello: world, | |
goodbye: pittsburgh, | |
); | |
@function replace-pair( | |
$map, | |
$needle, | |
$pair | |
) { | |
$new: (); | |
@each $key, $value in $map { | |
@if $key == $needle { | |
$new: map-merge($new, $pair); | |
} @else { | |
$new: map-merge($new, ($key: $value)); | |
} | |
} | |
@return $new; | |
} | |
@mixin output-map($map) { | |
@each $key, $value in $map { | |
#{$key}: $value; | |
} | |
} | |
$test: replace-pair($map, goodbye, (new: pair)); | |
.test { | |
@include output-map($test); | |
} |
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
.test { | |
hello: world; | |
new: pair; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment