rtl-converter

0.1.0 • Public • Published

RTL Converter

Simple way to Convert any stylesheet to RTL version

Installation

npm install rtl-converter

Motivation

Many manual converted RTL frameworks have been used and proved not to be quite flawless, for example, I couldn't find any Bootstrap RTL version that displays radio buttons correctly. This project tries to make the process flawless and automatic.

Output

Given the following stylesheet

.class {
  margin-left: 10px;
  text-align: left;
  background-color: #fff;
}

This will output
.class {
  background-color: #fff;
}
 
.rtl .class {
  margin-right: 10px;
}
 
.ltr .class {
  margin-left: 10px;
}

Usage

const rtlConverter = require('rtl-converter');
let RTLCss = rtlConverter(strCss);

to add RTL support, add class="rtl" to html tag,add direction set to rtl, for ltr you have to the the opposite.

RTL

...
<style> html {direction: rtl} </style> 
</head>
<html class="rtl">
...

LTR

...
<style> html {direction: ltr} </style> 
</head>
<html class="ltr">
...

Package Sidebar

Install

npm i rtl-converter

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

4.37 kB

Total Files

5

Last publish

Collaborators

  • hosseinalipour