cdes / sass-startend

Handy mixins for bidirectional css inspired by flex-start & flex-end behavior.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SASS Startend - Bidirectional CSS

Handy mixins for bidirectional css inspired by flex-start & flex-end behavior.


ℹ️ Input

div
  +padding-start(5px)
  +padding-end(10px)
  +margin-start(5px)
  +margin-end(10px)

🅾️ Output: ltr

div {
  padding-left: 5px;
  padding-right: 10px;
  margin-left: 5px;
  margin-right: 10px;
}

🅾️ Output: rtl

div {
  padding-right: 5px;
  padding-left: 10px;
  margin-right: 5px;
  margin-left: 10px;
}

🅾️ Output: bidi

html[dir='ltr'] div {
  padding-left: 5px;
  padding-right: 10px;
}

html[dir='rtl'] div {
  padding-left: 10px;
  padding-right: 5px;
}

html[dir='ltr'] div {
  margin-left: 5px;
  margin-right: 10px;
}

html[dir='rtl'] div {
  margin-left: 10px;
  margin-right: 5px; 
}

Installation

$ yarn add sass-startend

Usage

To produce a single CSS for both LTR & RTL (You must specifiy direction in your html <html dir="rtl">):

@import "~sass-startend/mixins/bidirectional"

// Your sass here

To produce a single CSS for each direction (You must have 2 entry files):

// RTL

$direction: rtl;
@import "~sass-startend/mixins/monodirectional"

// Your sass here
// LTR

$direction: ltr;
@import "~sass-startend/mixins/monodirectional"

// Your sass here

Still confused?

Take a look at bidi.sass, ltr.sass & rtl.sass in this repo.

License

This project is licensed under the MIT License

About

Handy mixins for bidirectional css inspired by flex-start & flex-end behavior.

License:MIT License


Languages

Language:CSS 100.0%