Created
July 31, 2014 11:29
-
-
Save MichaelArestad/421c344871f1ed483b4a 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.12) | |
| // Compass (v1.0.0.alpha.21) | |
| // ---- | |
| // Creates map for toc mixin to use | |
| $toc:(); | |
| // Sets initial toc value | |
| $toc-value: 0; | |
| @mixin toc($content, $sub: false) { | |
| @if $sub == false { // increments by 1 (rounding down) | |
| $toc-value: floor($toc-value) + 1 !global; | |
| } @else { // increments by .1 | |
| $toc-value: $toc-value + .1 !global; | |
| } | |
| // adds key (toc number) and value (string) to $toc map | |
| $toc: map-merge($toc, ($toc-value: $content)); | |
| /*-------------------------------------------------------------- | |
| #{$toc-value} - #{$content} | |
| --------------------------------------------------------------*/ | |
| } | |
| @include toc("Hello friend!"); | |
| @include toc("Let's tak about indices.", true); | |
| @include toc("Who doesn't love a good table of contents?"); | |
| @include toc("I do.", true); | |
| @include toc("I especially love generated ToCs.", true); | |
| @include toc("That's why I made this mixin.", true); | |
| @include toc("Now, reararranging partials with a ToC isn't a nightmare."); | |
| @include toc("You're welcome.", true); | |
| @each $number, $item in $toc { | |
| $spacing: ' '; | |
| @for $i from 1 to (6 - str-length('#{$number}')) { | |
| $spacing: $spacing + ' '; | |
| } | |
| /* #{$number}#{$spacing}- #{$item} */ | |
| } |
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
| /*-------------------------------------------------------------- | |
| 1 - Hello friend! | |
| --------------------------------------------------------------*/ | |
| /*-------------------------------------------------------------- | |
| 1.1 - Let's tak about indices. | |
| --------------------------------------------------------------*/ | |
| /*-------------------------------------------------------------- | |
| 2 - Who doesn't love a good table of contents? | |
| --------------------------------------------------------------*/ | |
| /*-------------------------------------------------------------- | |
| 2.1 - I do. | |
| --------------------------------------------------------------*/ | |
| /*-------------------------------------------------------------- | |
| 2.2 - I especially love generated ToCs. | |
| --------------------------------------------------------------*/ | |
| /*-------------------------------------------------------------- | |
| 2.3 - That's why I made this mixin. | |
| --------------------------------------------------------------*/ | |
| /*-------------------------------------------------------------- | |
| 3 - Now, reararranging partials with a ToC isn't a nightmare. | |
| --------------------------------------------------------------*/ | |
| /*-------------------------------------------------------------- | |
| 3.1 - You're welcome. | |
| --------------------------------------------------------------*/ | |
| /* 1 - Hello friend! */ | |
| /* 1.1 - Let's tak about indices. */ | |
| /* 2 - Who doesn't love a good table of contents? */ | |
| /* 2.1 - I do. */ | |
| /* 2.2 - I especially love generated ToCs. */ | |
| /* 2.3 - That's why I made this mixin. */ | |
| /* 3 - Now, reararranging partials with a ToC isn't a nightmare. */ | |
| /* 3.1 - You're welcome. */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment