In this tutorial I will explain framework for converting Left-To-Right (LTR) Cascading Style Sheets (CSS) to Right-To-Left (RTL). as some languages like Arabic, Hebrew, Persian, and Urdu are RTL writing. so in this tutorial will make an example for utopian-io website interface.
I recommend installing LTS version.
Open command prompt
Then type npm i rtlcss -g to instally it globally so we can call it later by typing just rtlcss
rtlcss [option option=parameter ...] [source] [destination]
rtlcss style.css style.rtl.css
{source}.rtl.{ext}Config
Configuration can be set using one of the following methods:
Default .rtlcssrc
{
"options": {
"autoRename": false,
"autoRenameStrict": false,
"blacklist":{},
"clean": true,
"greedy": false,
"processUrls": false,
"stringMap":[]
},
"plugins": [ ],
"map": false
}
So that can be used inside your project folder.
For command line options use
rtlcss -h or rtlcss -help
| Option | Description |
|---|---|
| -h,--help | Print help (this message) and exit. |
| -v,--version | Print version number and exit. |
| -c,--config | Path to configuration settings file. |
| - ,--stdin | Read from stdin stream. |
| -d,--dirctory | Process all *.css files from input directory (recursive). |
| -e,--ext | Used with -d option to set the output files extension. |
| Default: ".rtl.css". | |
| -s,--silent | Silent mode, no warnings or errors are printed. |
For example I will go to https://utopian.io/faq
Then I will extract the main style.css that is supposed to be LTR
Press Shift + F7
Save it and rename to style.css
Then open command prompt again then type rtlcss style.css style.rtl.css
Hit Enter
Then Edit style.rtl.css by any text editor
Like the following:
Add to body direction: rtl if not exist.
body as that can result in bad effectNow we have RTL interface for Utopian.io.
That's it