Skip to content

Instantly share code, notes, and snippets.

@alexrdz
Last active September 11, 2018 01:57
Show Gist options
  • Save alexrdz/75e44e08cc30a2e7ffff481af2d7ef1a to your computer and use it in GitHub Desktop.
Save alexrdz/75e44e08cc30a2e7ffff481af2d7ef1a to your computer and use it in GitHub Desktop.

Revisions

  1. alex rodriguez renamed this gist Sep 11, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. alex rodriguez created this gist Sep 11, 2018.
    56 changes: 56 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    @mixin utility-generator($prop, $direction, $iterator) {
    @for $index from 1 through $iterator {
    @if ($prop == 'padding') {
    .p#{$direction}-#{$index} {
    @if ($direction == 'x') {

    #{$prop}-left: $index * $utility-unit;
    #{$prop}-right: $index * $utility-unit;

    }
    @if ($direction == 'y') {

    #{$prop}-bottom: $index * $utility-unit;
    #{$prop}-top: $index * $utility-unit;

    }
    @if ($direction == 'l') {

    #{$prop}-left: $index * $utility-unit;

    }
    @if ($direction == 'r') {

    #{$prop}-right: $index * $utility-unit;

    }
    }
    }
    @if ($prop == 'margin') {
    .m#{$direction}-#{$index} {
    @if ($direction == 'x') {

    #{$prop}-left: $index * $utility-unit;
    #{$prop}-right: $index * $utility-unit;

    }
    @if ($direction == 'y') {

    #{$prop}-bottom: $index * $utility-unit;
    #{$prop}-top: $index * $utility-unit;

    }
    @if ($direction == 'l') {

    #{$prop}-left: $index * $utility-unit;

    }
    @if ($direction == 'r') {

    #{$prop}-right: $index * $utility-unit;

    }
    }
    }
    }
    }