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/9f158cc1046cb5167a7f to your computer and use it in GitHub Desktop.

Select an option

Save stowball/9f158cc1046cb5167a7f to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
/*
LINE 44 - CHECKING & SETTING MAPS FAILS IN 3.4.x
*/
$mixin-denominator-numbers: (1 2 3 4 5 6 7 8 9 10 11 12) !default;
$mixin-numerators: (one two three four five six seven
eight nine ten eleven twelve)
!default;
$mixin-denominator-words: (whole half third quarter fifth sixth
seventh eighth ninth tenth eleventh
twelfth) !default;
$_percentage-class-instances: () !default;
@mixin generate-percentage-classes-at-breakpoints(
$scally-type: "u", $class-name: null, $css-property: "width") {
@include generate-percentage-classes("", $scally-type, $class-name,
$css-property);
}
@mixin generate-percentage-classes($breakpoint: "", $scally-type: "u",
$class-name: null, $css-property: "width") {
@each $denominator in $mixin-denominator-numbers {
@for $numerator from 1 through max($denominator - 1, 1) {
$percent-width-class: ($numerator/$denominator) * 100;
@if round($percent-width-class) == ceil($percent-width-class) {
$percent-width-class: ceil($percent-width-class);
}
@else {
$percent-width-class: floor($percent-width-class);
}
$selector: ".#{$scally-type}-#{$class-name}#{$percent-width-class}pc#{$breakpoint}";
@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} {
#{$css-property}: percentage($numerator/$denominator);
}
}
}
}
}
@mixin debug-map($map) {
@at-root {
@debug-map {
__toString__: inspect($map);
__length__: length($map);
__depth__: depth($map);
__keys__: map-keys($map);
__properties__ {
@each $key, $value in $map {
#{'(' + type-of($value) + ') ' + $key}: inspect($value);
}
}
}
}
}
@include generate-percentage-classes-at-breakpoints();
.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 44 - 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-33pc";
}
.u-33pc {
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-33pc";
}
a {
content: "3 instance(s) of .u-50pc";
}
a {
content: "2 instance(s) of .u-67pc";
}
a {
content: "1 instance(s) of .u-83pc";
}
.u-83pc {
width: 83.33333%;
}
a {
content: "1 instance(s) of .u-14pc";
}
.u-14pc {
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-57pc";
}
.u-57pc {
width: 57.14286%;
}
a {
content: "1 instance(s) of .u-71pc";
}
.u-71pc {
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-11pc";
}
.u-11pc {
width: 11.11111%;
}
a {
content: "1 instance(s) of .u-22pc";
}
.u-22pc {
width: 22.22222%;
}
a {
content: "3 instance(s) of .u-33pc";
}
a {
content: "1 instance(s) of .u-44pc";
}
.u-44pc {
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: "1 instance(s) of .u-9pc";
}
.u-9pc {
width: 9.09091%;
}
a {
content: "1 instance(s) of .u-18pc";
}
.u-18pc {
width: 18.18182%;
}
a {
content: "1 instance(s) of .u-27pc";
}
.u-27pc {
width: 27.27273%;
}
a {
content: "1 instance(s) of .u-36pc";
}
.u-36pc {
width: 36.36364%;
}
a {
content: "1 instance(s) of .u-45pc";
}
.u-45pc {
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-8pc";
}
.u-8pc {
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-33pc";
}
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-58pc";
}
.u-58pc {
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-83pc";
}
a {
content: "1 instance(s) of .u-92pc";
}
.u-92pc {
width: 91.66667%;
}
.inspect-map {
content: '(".u-100pc": 1, ".u-50pc": 6, ".u-33pc": 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-83pc": 2, ".u-14pc": 1, ".u-29pc": 1, ".u-43pc": 1, ".u-57pc": 1, ".u-71pc": 1, ".u-86pc": 1, ".u-13pc": 1, ".u-38pc": 1, ".u-63pc": 1, ".u-88pc": 1, ".u-11pc": 1, ".u-22pc": 1, ".u-44pc": 1, ".u-56pc": 1, ".u-78pc": 1, ".u-89pc": 1, ".u-10pc": 1, ".u-30pc": 1, ".u-70pc": 1, ".u-90pc": 1, ".u-9pc": 1, ".u-18pc": 1, ".u-27pc": 1, ".u-36pc": 1, ".u-45pc": 1, ".u-55pc": 1, ".u-64pc": 1, ".u-73pc": 1, ".u-82pc": 1, ".u-91pc": 1, ".u-8pc": 1, ".u-42pc": 1, ".u-58pc": 1, ".u-92pc": 1)';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment