From bbe7d053a33fd398c276f67e16f755bd7922f365 Mon Sep 17 00:00:00 2001 From: Harry Roberts Date: Wed, 29 Mar 2017 14:26:02 +0100 Subject: [PATCH] [refs #00012] Rename Supercell main mixin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The name `widths()` wasn’t great, and is likely to cause collisions with other libraries. Renamed the `widths()` mixin to `supercell()` and also provided a wrapper around the new mixin in order to provide legacy support up until Supercell 2.0.0 --- README.md | 8 ++++---- _tools.widths.scss | 17 +++++++++++++---- package.json | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c06954c..3ba3f41 100644 --- a/README.md +++ b/README.md @@ -85,19 +85,19 @@ like to create. To create a 12 column layout system, simply call the mixin like so: ```SCSS -@include widths(12); +@include supercell(12); ``` To generate a 12 and a 16 column layout system, call the mixin like so: ```SCSS -@include widths(12 16); +@include supercell(12 16); ``` To generate a 3, a 4, and an 8 column layout system, call the mixin like so: ```SCSS -@include widths(3 4 8); +@include supercell(3 4 8); ``` Supercell will now generate a full suite of classes that will satisfy every @@ -124,7 +124,7 @@ To generate a 12 column layout system for use on screens over 1200px wide: ```SCSS @media screen and (min-width: 1200px) { - @include widths(12, \@large); + @include supercell(12, \@large); } ``` diff --git a/_tools.widths.scss b/_tools.widths.scss index 79ca522..292b67a 100644 --- a/_tools.widths.scss +++ b/_tools.widths.scss @@ -20,24 +20,24 @@ // // To create a non-responsive 12 column grid system, simply call: // -// @include widths(12); +// @include supercell(12); // // To create a 3 and 4 column grid system on medium sized screens: // // @media screen and (min-width: 720px) { -// @include widths(3 4, \@medium); +// @include supercell(3 4, \@medium); // } // // To create a 1, 2, 3 and 4 column grid system on large sized screens: // // @media screen and (min-width: 1024px) { -// @include widths(1 2 3 4, \@large); +// @include supercell(1 2 3 4, \@large); // } // // Basically, we just call the mixin again but inside of a breakpoint of our // choosing, and with the additional responsive suffix (e.g. `\@large`). -@mixin widths($columns, $breakpoint: null) { +@mixin supercell($columns, $breakpoint: null) { // Loop through the number of columns for each denominator of our fractions. @each $denominator in $columns { @@ -79,3 +79,12 @@ } } + +// In order to support the legacy `widths()` mixin, let’s create a simple +// wrapper around the new `supercell()` mixin. This allows developers to use the +// older Supercell API. This will be removed in 2.0.0. +@mixin widths($args...) { + @include supercell($args...); + + @warn "Support for `widths()` will be removed in Supercell @2.0.0. Use `supercell()` instead." +} diff --git a/package.json b/package.json index 9d84cc3..aaa2a57 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "supercell", - "version": "1.0.0", + "version": "1.1.0", "description": "Grid-like layout system.", "scripts": { "test": "echo \"Error: no test specified\" && exit 1",