Sha256: cbfd00770836edc24de7c97a8d22d3b652b52bfa961577191628b49470e3e8a1

Contents?: true

Size: 1.47 KB

Versions: 5

Compression:

Stored size: 1.47 KB

Contents

// 16 arguments can be passed into this function
// a max of 16 comma seperated grids
@function compound($cg1: 1, $cg2: 1, $cg3: 1, $cg4: 1, $cg5: 1, $cg6: 1, $cg7: 1, $cg8: 1, $cg9: 1, $cg10: 1, $cg11: 1, $cg12: 1, $cg13: 1, $cg14: 1, $cg15: 1, $cg16: 1) {

  // merge arguments into a single list.
  $compound-grids: $cg1, $cg2, $cg3, $cg4, $cg5, $cg6, $cg7, $cg8, $cg9, $cg10, $cg11, $cg12, $cg13, $cg14, $cg15, $cg16;

  // Find the base resolution of grid
  $resolution: 1;
  @each $item in $compound-grids {
    $resolution: $resolution * $item;
  }

  $compound-grid: ();
  $compound-counter: 1;
  // cycle through each step in grid resolution
  @for $i from 1 through $resolution {

    // dont add a column by default
    $add-col: false;

    // cycle through all grids to see if any grids match
    @each $grid in $compound-grids {

      // if the grid divides evenly into the resolution, add a column
      // divide the resolution by number of columns to get the column resolution
      @if $i / ($resolution / $grid) == round($i / ($resolution / $grid)) {
        $add-col: true;
      }
    }

    // add the counter value to the compound grid list, reset counter
    // this marks where one column ends and a new one begins
    @if $add-col {
      $compound-grid: join($compound-grid, $compound-counter);
      $compound-counter: 1;
    }
    // if no column is added, bump up counter
    @else {
      $compound-counter: $compound-counter + 1;
    }
  }

  @return $compound-grid;
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
singularity-extras-1.0.0.alpha.3 stylesheets/singularity-extras/generators/_compound.scss
singularity-extras-1.0.0.alpha.2 stylesheets/singularity-extras/generators/_compound.scss
singularity-extras-1.0.0.alpha.1 stylesheets/singularity-extras/generators/_compound.scss
singularity-extras-0.0.3 stylesheets/singularity-extras/generators/_compound.scss
singularity-extras-0.0.2 stylesheets/singularity-extras/generators/_compound.scss