Last active
August 29, 2015 14:22
-
-
Save stowball/415d43ce191c38546e7f 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.3.14) | |
| // Compass (v1.0.1) | |
| // ---- | |
| $mixin-denominator-numbers: (1 2 3) !default; | |
| $_percentage-class-instances: () !default; | |
| @mixin generate-percentage-classes() { | |
| @each $denominator in $mixin-denominator-numbers { | |
| $selector: ".u-#{$denominator * 100}pc"; | |
| @if (map-has-key($_percentage-class-instances, $selector)) { | |
| $_percentage-class-instances: map-merge($_percentage-class-instances, ($selector: 2)); | |
| } | |
| @else { | |
| $_percentage-class-instances: map-merge($_percentage-class-instances, ($selector: 1)); | |
| } | |
| @if (map-get($_percentage-class-instances, $selector) == 1) { | |
| #{$selector} { | |
| width: percentage($denominator); | |
| } | |
| } | |
| } | |
| } | |
| @include generate-percentage-classes(); |
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
| .u-100pc { | |
| width: 100%; | |
| } | |
| .u-200pc { | |
| width: 200%; | |
| } | |
| .u-300pc { | |
| width: 300%; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment