-
-
Save cmpscabral/b4e448d671a876b95fd16d6bfd5d06e1 to your computer and use it in GitHub Desktop.
Revisions
-
adamgiese revised this gist
May 18, 2017 . 1 changed file with 13 additions and 11 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,15 @@ @mixin valid-quantity($quantity) { @if type-of($quantity) != 'number' { @error 'The "quantity" parameter must be a number!'; } @if not(unitless($quantity)) { @error 'The "quantity" parameter must not have a unit!'; } @if $quantity < 0 { @error 'The "quantity" parameter must be at least 0!'; } } @mixin has-nth($expression, $element: '*') { &:nth-last-child(#{$expression}):first-child, &:nth-last-child(#{$expression}):first-child ~ #{$element} { @@ -45,14 +57,4 @@ } } -
adamgiese revised this gist
May 15, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ @mixin has-nth($expression, $element: '*') { &:nth-last-child(#{$expression}):first-child, &:nth-last-child(#{$expression}):first-child ~ #{$element} { @content; } } -
adamgiese created this gist
May 13, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ @mixin has-nth($expression, $element: '*') { &:nth-last-child(#{$expression}):first-child, &:nth-last-child(#{$expression}):first-child ~ * { @content; } } @mixin at-least($quantity, $element: '*') { @include valid-quantity($quantity); @include has-nth('n + #{$quantity}', $element) { @content; } } @mixin at-most($quantity, $element: '*') { @include valid-quantity($quantity); @include has-nth('-n + #{$quantity}', $element) { @content; } } @mixin divisible-by($quantity, $offset: 0, $element: '*') { @include valid-quantity($quantity); @include has-nth('#{$quantity}n + #{$offset}', $element) { @content; } } @mixin has-exactly($quantity, $element: '*') { @include valid-quantity($quantity); @include has-nth('#{$quantity}', $element) { @content; } } @mixin has-odd($element: '*') { @include has-nth('odd', $element) { @content; } } @mixin has-even($element: '*') { @include has-nth('even', $element) { @content; } } @mixin valid-quantity($quantity) { @if type-of($quantity) != 'number' { @error 'The "quantity" parameter must be a number!'; } @if not(unitless($quantity)) { @error 'The "quantity" parameter must not have a unit!'; } @if $quantity < 0 { @error 'The "quantity" parameter must be at least 0!'; } }