Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pierre Burel
committed
Dec 8, 2016
0 parents
commit fd482e7
Showing
5 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Direction | ||
|
||
Sass mixins and functions to help creating bi-directional stylesheets. | ||
|
||
Compatibility: [Sass](https://github.com/sass/sass) and [LibSass](https://github.com/sass/libsass) | ||
|
||
--- | ||
|
||
## Install | ||
|
||
Download [`_direction.scss`](https://raw.githubusercontent.com/pierreburel/sass-direction/master/_direction.scss) or install with [npm](https://www.npmjs.com/) or [Bower](http://bower.io/) : | ||
|
||
### npm | ||
|
||
``` | ||
npm install sass-direction | ||
``` | ||
|
||
### Bower | ||
|
||
``` | ||
bower install sass-direction | ||
``` | ||
|
||
--- | ||
|
||
## Usage | ||
|
||
Coming soon! | ||
|
||
--- | ||
|
||
## Credits | ||
|
||
Hugely based on [Tyson Matanich](http://matanich.com)’s [idea](https://github.com/tysonmatanich/directional-scss). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
$direction: ltr !default; | ||
|
||
@function direction($value) { | ||
@if $direction == rtl and ($value == left or $value == right) { | ||
@return if($value == left, right, left); | ||
} @else { | ||
@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); | ||
} @else { | ||
@return $values; | ||
} | ||
} | ||
|
||
@function direction-corners($values) { | ||
@if $direction == rtl and length($values) > 1 { | ||
@if length($values) == 2 { | ||
@return nth($values, 2) nth($values, 1); | ||
} @else if length($values) == 3 { | ||
@return nth($values, 2) nth($values, 1) nth($values, 2) nth($values, 3); | ||
} @else { | ||
@return nth($values, 2) nth($values, 1) nth($values, 4) nth($values, 3); | ||
} | ||
} @else { | ||
@return $values; | ||
} | ||
} | ||
|
||
@function direction-if($condition, $if, $else: null) { | ||
@return if($direction == $condition, $if, $else); | ||
} | ||
|
||
@function direction-ltr($if, $else: null) { | ||
@return direction-if(ltr, $if, $else); | ||
} | ||
|
||
@function direction-rtl($if, $else: null) { | ||
@return direction-if(rtl, $if, $else); | ||
} | ||
|
||
@mixin direction { | ||
direction: $direction; | ||
} | ||
|
||
@mixin direction-if($condition) { | ||
@if $direction == $condition { | ||
@content; | ||
} | ||
} | ||
|
||
@mixin direction-ltr { | ||
@include direction-if(ltr) { | ||
@content; | ||
} | ||
} | ||
|
||
@mixin direction-rtl { | ||
@include direction-if(rtl) { | ||
@content; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "sass-direction", | ||
"description": "Sass mixins and functions to help creating bi-directional stylesheets.", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/pierreburel/sass-direction", | ||
"main": "_direction.scss", | ||
"authors": [ | ||
"Pierre Burel <pierre.burel@gmail.com>" | ||
], | ||
"keywords": [ | ||
"sass", | ||
"direction", | ||
"bidi", | ||
"i18n" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"sache.json", | ||
"package.json" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "sass-direction", | ||
"version": "1.0.0", | ||
"description": "Sass mixins and functions to help creating bi-directional stylesheets.", | ||
"keywords": [ | ||
"sass", | ||
"direction", | ||
"bidi", | ||
"i18n" | ||
], | ||
"homepage": "https://github.com/pierreburel/sass-direction", | ||
"bugs": { | ||
"url": "https://github.com/pierreburel/sass-direction/issues" | ||
}, | ||
"license": "MIT", | ||
"author": "Pierre Burel <pierre.burel@gmail.com>", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/pierreburel/sass-direction.git" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "sass-direction", | ||
"description": "Sass mixins and functions to help creating bi-directional stylesheets.", | ||
"tags": [ | ||
"sass", | ||
"direction", | ||
"bidi", | ||
"i18n" | ||
], | ||
"website": "https://github.com/pierreburel/sass-direction" | ||
} |