Skip to content

Commit

Permalink
Remove flexbox properties
Browse files Browse the repository at this point in the history
  • Loading branch information
pierreburel committed Jan 17, 2018
1 parent 27472c2 commit 7074215
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 24 deletions.
20 changes: 7 additions & 13 deletions README.md
Expand Up @@ -2,9 +2,9 @@

Sass mixins and functions to help creating bi-directional stylesheets.

Compatibility: [Sass](https://github.com/sass/sass) and [LibSass](https://github.com/sass/libsass)
Compatibility: [Sass](https://github.com/sass/sass) and [LibSass](https://github.com/sass/libsass)

---
---

## Install

Expand Down Expand Up @@ -38,23 +38,21 @@ h1 {
border: direction-corners(1em 2em 3em 4em);
font-size: direction-if(ltr, 1em, 2em);
line-height: direction-if(rtl, 2);
flex-direction: direction(row);
justify-content: direction(flex-start);


@include direction-if(ltr) {
&::before {
content: "left to right";
}
}

@include direction-if(rtl) {
&::after {
content: "right to left";
}
}

direction: direction(rtl);

& > span {
direction: direction(ltr);
}
Expand All @@ -81,8 +79,6 @@ h1 {
padding: 1em 2em 3em 4em;
border: 1em 2em 3em 4em;
font-size: 1em;
flex-direction: row;
justify-content: flex-start;
direction: rtl;
}
h1::before {
Expand All @@ -104,8 +100,6 @@ h1 {
border: 2em 1em 4em 3em;
font-size: 2em;
line-height: 2;
flex-direction: row-reverse;
justify-content: flex-end;
direction: ltr;
}
h1::after {
Expand All @@ -125,7 +119,7 @@ h1 > span {
- Mixin `direction-ltr`: `direction-if(ltr)`
- Mixin `direction-rtl`: `direction-if(rtl)`

---
---

## Credits

Expand Down
14 changes: 5 additions & 9 deletions _direction.scss
@@ -1,28 +1,24 @@
$direction: ltr !default;
$direction-values: (
ltr: rtl,
ltr: rtl,
rtl: ltr,
left: right,
right: left,
flex-start: flex-end,
flex-end: flex-start,
row: row-reverse,
row-reverse: row
right: left
) !default;

@function direction($value) {
@if $direction == rtl and map-has-key($direction-values, $value) {
@return map-get($direction-values, $value);
}

@return $value;
}

@function direction-sides($values) {
@if $direction == rtl and length($values) == 4 {
@return nth($values, 1) nth($values, 4) nth($values, 3) nth($values, 2);
}

@return $values;
}

Expand All @@ -36,7 +32,7 @@ $direction-values: (
@return nth($values, 2) nth($values, 1) nth($values, 4) nth($values, 3);
}
}

@return $values;
}

Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,7 +1,7 @@
{
"name": "sass-direction",
"description": "Sass mixins and functions to help creating bi-directional stylesheets.",
"version": "1.1.0",
"version": "1.2.0",
"homepage": "https://github.com/pierreburel/sass-direction",
"main": "_direction.scss",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "sass-direction",
"version": "1.1.0",
"version": "1.2.0",
"description": "Sass mixins and functions to help creating bi-directional stylesheets.",
"keywords": [
"sass",
Expand Down

0 comments on commit 7074215

Please sign in to comment.