Skip to content

Instantly share code, notes, and snippets.

@stowball
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save stowball/f9307987f1b3b4f6546f to your computer and use it in GitHub Desktop.

Select an option

Save stowball/f9307987f1b3b4f6546f to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
/*
LINE 20 - CHECKING & SETTING MAPS FAILS IN 3.4.x
*/
$mixin-denominator-numbers: (1 2 3 4 5 6 7 8 9 10 11 12) !default;
$_percentage-class-instances: () !default;
@mixin generate-percentage-classes() {
@each $denominator in $mixin-denominator-numbers {
@for $numerator from 1 through max($denominator - 1, 1) {
$selector: ".u-#{ceil(($numerator/$denominator) * 100)}pc";
@if (map-has-key($_percentage-class-instances, $selector)) {
$_percentage-class-instances: map-merge($_percentage-class-instances, ($selector: map-get($_percentage-class-instances, $selector) + 1));
}
@else {
$_percentage-class-instances: map-merge($_percentage-class-instances, ($selector: 1));
}
a { content: "#{map-get($_percentage-class-instances, $selector)} instance(s) of #{$selector}"; }
@if (map-get($_percentage-class-instances, $selector) == 1) {
#{$selector} {
width: percentage($numerator/$denominator);
}
}
}
}
}
@include generate-percentage-classes();
@mixin debug-map($map) {
@at-root {
@debug-map {
__toString__: inspect($map);
__length__: length($map);
__keys__: map-keys($map);
__properties__ {
@each $key, $value in $map {
#{'(' + type-of($value) + ') ' + $key}: inspect($value);
}
}
}
}
}
.inspect-map {
content: "#{inspect($_percentage-class-instances)}";
}
// Uncommenting debug-map fails in 3.3 & 3.4 with "isn't a valid css value".
//@include debug-map($_percentage-class-instances);
/*
LINE 20 - CHECKING & SETTING MAPS FAILS IN 3.4.x
*/
a {
content: "1 instance(s) of .u-100pc";
}
.u-100pc {
width: 100%;
}
a {
content: "1 instance(s) of .u-50pc";
}
.u-50pc {
width: 50%;
}
a {
content: "1 instance(s) of .u-34pc";
}
.u-34pc {
width: 33.33333%;
}
a {
content: "1 instance(s) of .u-67pc";
}
.u-67pc {
width: 66.66667%;
}
a {
content: "1 instance(s) of .u-25pc";
}
.u-25pc {
width: 25%;
}
a {
content: "2 instance(s) of .u-50pc";
}
a {
content: "1 instance(s) of .u-75pc";
}
.u-75pc {
width: 75%;
}
a {
content: "1 instance(s) of .u-20pc";
}
.u-20pc {
width: 20%;
}
a {
content: "1 instance(s) of .u-40pc";
}
.u-40pc {
width: 40%;
}
a {
content: "1 instance(s) of .u-60pc";
}
.u-60pc {
width: 60%;
}
a {
content: "1 instance(s) of .u-80pc";
}
.u-80pc {
width: 80%;
}
a {
content: "1 instance(s) of .u-17pc";
}
.u-17pc {
width: 16.66667%;
}
a {
content: "2 instance(s) of .u-34pc";
}
a {
content: "3 instance(s) of .u-50pc";
}
a {
content: "2 instance(s) of .u-67pc";
}
a {
content: "1 instance(s) of .u-84pc";
}
.u-84pc {
width: 83.33333%;
}
a {
content: "1 instance(s) of .u-15pc";
}
.u-15pc {
width: 14.28571%;
}
a {
content: "1 instance(s) of .u-29pc";
}
.u-29pc {
width: 28.57143%;
}
a {
content: "1 instance(s) of .u-43pc";
}
.u-43pc {
width: 42.85714%;
}
a {
content: "1 instance(s) of .u-58pc";
}
.u-58pc {
width: 57.14286%;
}
a {
content: "1 instance(s) of .u-72pc";
}
.u-72pc {
width: 71.42857%;
}
a {
content: "1 instance(s) of .u-86pc";
}
.u-86pc {
width: 85.71429%;
}
a {
content: "1 instance(s) of .u-13pc";
}
.u-13pc {
width: 12.5%;
}
a {
content: "2 instance(s) of .u-25pc";
}
a {
content: "1 instance(s) of .u-38pc";
}
.u-38pc {
width: 37.5%;
}
a {
content: "4 instance(s) of .u-50pc";
}
a {
content: "1 instance(s) of .u-63pc";
}
.u-63pc {
width: 62.5%;
}
a {
content: "2 instance(s) of .u-75pc";
}
a {
content: "1 instance(s) of .u-88pc";
}
.u-88pc {
width: 87.5%;
}
a {
content: "1 instance(s) of .u-12pc";
}
.u-12pc {
width: 11.11111%;
}
a {
content: "1 instance(s) of .u-23pc";
}
.u-23pc {
width: 22.22222%;
}
a {
content: "3 instance(s) of .u-34pc";
}
a {
content: "1 instance(s) of .u-45pc";
}
.u-45pc {
width: 44.44444%;
}
a {
content: "1 instance(s) of .u-56pc";
}
.u-56pc {
width: 55.55556%;
}
a {
content: "3 instance(s) of .u-67pc";
}
a {
content: "1 instance(s) of .u-78pc";
}
.u-78pc {
width: 77.77778%;
}
a {
content: "1 instance(s) of .u-89pc";
}
.u-89pc {
width: 88.88889%;
}
a {
content: "1 instance(s) of .u-10pc";
}
.u-10pc {
width: 10%;
}
a {
content: "2 instance(s) of .u-20pc";
}
a {
content: "1 instance(s) of .u-30pc";
}
.u-30pc {
width: 30%;
}
a {
content: "2 instance(s) of .u-40pc";
}
a {
content: "5 instance(s) of .u-50pc";
}
a {
content: "2 instance(s) of .u-60pc";
}
a {
content: "1 instance(s) of .u-70pc";
}
.u-70pc {
width: 70%;
}
a {
content: "2 instance(s) of .u-80pc";
}
a {
content: "1 instance(s) of .u-90pc";
}
.u-90pc {
width: 90%;
}
a {
content: "2 instance(s) of .u-10pc";
}
a {
content: "1 instance(s) of .u-19pc";
}
.u-19pc {
width: 18.18182%;
}
a {
content: "1 instance(s) of .u-28pc";
}
.u-28pc {
width: 27.27273%;
}
a {
content: "1 instance(s) of .u-37pc";
}
.u-37pc {
width: 36.36364%;
}
a {
content: "1 instance(s) of .u-46pc";
}
.u-46pc {
width: 45.45455%;
}
a {
content: "1 instance(s) of .u-55pc";
}
.u-55pc {
width: 54.54545%;
}
a {
content: "1 instance(s) of .u-64pc";
}
.u-64pc {
width: 63.63636%;
}
a {
content: "1 instance(s) of .u-73pc";
}
.u-73pc {
width: 72.72727%;
}
a {
content: "1 instance(s) of .u-82pc";
}
.u-82pc {
width: 81.81818%;
}
a {
content: "1 instance(s) of .u-91pc";
}
.u-91pc {
width: 90.90909%;
}
a {
content: "1 instance(s) of .u-9pc";
}
.u-9pc {
width: 8.33333%;
}
a {
content: "2 instance(s) of .u-17pc";
}
a {
content: "3 instance(s) of .u-25pc";
}
a {
content: "4 instance(s) of .u-34pc";
}
a {
content: "1 instance(s) of .u-42pc";
}
.u-42pc {
width: 41.66667%;
}
a {
content: "6 instance(s) of .u-50pc";
}
a {
content: "1 instance(s) of .u-59pc";
}
.u-59pc {
width: 58.33333%;
}
a {
content: "4 instance(s) of .u-67pc";
}
a {
content: "3 instance(s) of .u-75pc";
}
a {
content: "2 instance(s) of .u-84pc";
}
a {
content: "1 instance(s) of .u-92pc";
}
.u-92pc {
width: 91.66667%;
}
.inspect-map {
content: '(".u-100pc": 1, ".u-50pc": 6, ".u-34pc": 4, ".u-67pc": 4, ".u-25pc": 3, ".u-75pc": 3, ".u-20pc": 2, ".u-40pc": 2, ".u-60pc": 2, ".u-80pc": 2, ".u-17pc": 2, ".u-84pc": 2, ".u-15pc": 1, ".u-29pc": 1, ".u-43pc": 1, ".u-58pc": 1, ".u-72pc": 1, ".u-86pc": 1, ".u-13pc": 1, ".u-38pc": 1, ".u-63pc": 1, ".u-88pc": 1, ".u-12pc": 1, ".u-23pc": 1, ".u-45pc": 1, ".u-56pc": 1, ".u-78pc": 1, ".u-89pc": 1, ".u-10pc": 2, ".u-30pc": 1, ".u-70pc": 1, ".u-90pc": 1, ".u-19pc": 1, ".u-28pc": 1, ".u-37pc": 1, ".u-46pc": 1, ".u-55pc": 1, ".u-64pc": 1, ".u-73pc": 1, ".u-82pc": 1, ".u-91pc": 1, ".u-9pc": 1, ".u-42pc": 1, ".u-59pc": 1, ".u-92pc": 1)';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment