Created
December 11, 2014 17:31
-
-
Save jtwalters/f30948863c5098e658a3 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
<div class="gallery-item">1</div> | |
<div class="gallery-item">2</div> | |
<div class="gallery-item">3</div> | |
<div class="gallery-item">4</div> | |
<div class="gallery-item">5</div> | |
<div class="gallery-item">6</div> | |
<div class="gallery-item">7</div> | |
<div class="gallery-item">8</div> | |
<div class="gallery-item">9</div> | |
<div class="gallery-item">10</div> | |
<div class="gallery-item">11</div> | |
<div class="gallery-item">12</div> | |
<div class="debug"></div> |
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.4.7) | |
// Compass (v1.0.1) | |
// Breakpoint (v2.5.0) | |
// Susy (v2.1.3) | |
// ---- | |
@import "susy"; | |
@import "breakpoint"; | |
// Returns $list as a string | |
// ------------------------------------------------------------------------------- | |
// @documentation http://sassylists.com/documentation/#debug | |
// ------------------------------------------------------------------------------- | |
// @example debug(a b c d e) => [ a, b, c, d, e ] | |
// @example debug(a b (c d e)) => [ a, b, [ c, d, e ] ] | |
// ------------------------------------------------------------------------------- | |
// @param $list [List] : list | |
// @param $pre [Boolean] : enable/disable variables type and proper indentation | |
// @param $level [Number] : internal variable for recursivity | |
// ------------------------------------------------------------------------------- | |
// @return [String] | |
@function debug($list, $pre: false, $level: 1) { | |
$tab: " "; | |
$indent: ""; | |
$break: if($pre, "\A ", ""); | |
@if length($list) == 0 { | |
@return "( )"; | |
} | |
@if length($list) == 1 { | |
@return if($pre, "(" + type-of($list) + ") ", "") + $list; | |
} | |
@for $i from 1 to $level { | |
$indent: $indent + $tab; | |
} | |
$result: "[" + $break; | |
@for $i from 1 through length($list) { | |
$item: nth($list, $i); | |
$result: $result + if($pre, $indent + $tab, " "); | |
@if length($item) > 1 { | |
$result: $result | |
+ if($pre, "(list: " + length($item) + ") ", "") | |
+ debug($item, $pre, $level + 1); | |
} | |
@else { | |
@if $pre { | |
$result: $result + "(" + type-of($item) + ") "; | |
} | |
@if length($item) == 0 { | |
$result: $result + "( )"; | |
} | |
@else if type-of($item) == string { | |
$result: $result + quote($item); | |
} | |
@else if $item == null { | |
$result: $result + "null"; | |
} | |
@else { | |
$result: $result + $item; | |
} | |
} | |
@if $i != length($list) { | |
$result: $result + "," + $break; | |
} | |
} | |
$result: $result + $break + if($pre, if($level > 1, $indent, ""), " ") + "]"; | |
@return quote($result); | |
} | |
// Mixin displaying clean debug | |
// ------------------------------------------------------------------------------- | |
// @param $list [List] : list | |
@mixin debug($list) { | |
body:before { | |
content: debug($list, true) !important; | |
display: block !important; | |
margin: 1em !important; | |
padding: .5em !important; | |
background: #EFEFEF !important; | |
border: 1px solid #DDD !important; | |
border-radius: .2em !important; | |
color: #333 !important; | |
font: .75em/1.5 "Courier New", monospace !important; | |
text-shadow: 0 1px white !important; | |
white-space: pre-wrap !important; | |
} | |
} | |
$grid-small: 12 1; | |
$grid-large: 12 1/3; | |
$grid960: layout(12 (60px 20px) split static); | |
$susy: layout($grid-small); | |
$text-sizes: ( | |
10px | |
11px | |
12px | |
14px | |
15px | |
16px | |
20px | |
25px | |
); | |
$lg-text-sizes: ( | |
10px | |
11px | |
12px | |
14px | |
16px | |
18px | |
24px | |
36px | |
); | |
/** | |
* Simple debug function | |
*/ | |
.debug { | |
@include break; | |
} | |
.debug:after { | |
display: block; | |
content: debug($text-sizes); | |
} | |
.gallery-item { | |
height: 100px; | |
background: red; | |
@include span(1); | |
&:nth-child(12) { | |
@include last; | |
} | |
} | |
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
/** | |
* Simple debug function | |
*/ | |
.debug { | |
clear: both; | |
} | |
.debug:after { | |
display: block; | |
content: "[ 10px, 11px, 12px, 14px, 15px, 16px, 20px, 25px ]"; | |
} | |
.gallery-item { | |
height: 100px; | |
background: red; | |
width: 4.34783%; | |
float: left; | |
margin-right: 4.34783%; | |
} | |
.gallery-item:nth-child(12) { | |
float: right; | |
margin-right: 0; | |
} |
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
<div class="gallery-item">1</div> | |
<div class="gallery-item">2</div> | |
<div class="gallery-item">3</div> | |
<div class="gallery-item">4</div> | |
<div class="gallery-item">5</div> | |
<div class="gallery-item">6</div> | |
<div class="gallery-item">7</div> | |
<div class="gallery-item">8</div> | |
<div class="gallery-item">9</div> | |
<div class="gallery-item">10</div> | |
<div class="gallery-item">11</div> | |
<div class="gallery-item">12</div> | |
<div class="debug"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment