summaryrefslogtreecommitdiff
path: root/_sass/bourbon/functions/_unpack.scss
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2024-02-08 16:36:31 -0600
committerHombreLaser <sebastian-440@live.com>2024-02-08 16:36:31 -0600
commite182245d3205d929881f51da9b48d6c4ed97a682 (patch)
treed390e8754dec70a9c9293afb801321b96f043c15 /_sass/bourbon/functions/_unpack.scss
Commit inicialHEADmaster
Diffstat (limited to '_sass/bourbon/functions/_unpack.scss')
-rw-r--r--_sass/bourbon/functions/_unpack.scss27
1 files changed, 27 insertions, 0 deletions
diff --git a/_sass/bourbon/functions/_unpack.scss b/_sass/bourbon/functions/_unpack.scss
new file mode 100644
index 0000000..4367935
--- /dev/null
+++ b/_sass/bourbon/functions/_unpack.scss
@@ -0,0 +1,27 @@
+@charset "UTF-8";
+
+/// Converts shorthand to the 4-value syntax.
+///
+/// @param {List} $shorthand
+///
+/// @example scss - Usage
+/// .element {
+/// margin: unpack(1em 2em);
+/// }
+///
+/// @example css - CSS Output
+/// .element {
+/// margin: 1em 2em 1em 2em;
+/// }
+
+@function unpack($shorthand) {
+ @if length($shorthand) == 1 {
+ @return nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1);
+ } @else if length($shorthand) == 2 {
+ @return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 1) nth($shorthand, 2);
+ } @else if length($shorthand) == 3 {
+ @return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 3) nth($shorthand, 2);
+ } @else {
+ @return $shorthand;
+ }
+}