
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
rtl-generator
Advanced tools
A utility to convert any existing left-to-right written css files into right-to-left css automatically.
A utility to convert any existing left-to-right written css files into right-to-left css.
Suppose you have a website in English (left-to-right) and now you want a way to save manual work and use this utility to automatically generating a right-to-left css which will allow your users to switch.
This utility generates only the code which is modified for rtl. Unlike the css-flip from Twitter which generates css files containing all the untouched css.


npm install rtl-generator -g
Output the rtl css
var rtlGenerator = require('rtl-generator');
const result = await rtlGenerator({
returnOutputOnly: true,
inputFiles: ['./ltr/style.css']
});
Append rtl css to the same file
var rtlGenerator = require('rtl-generator');
const result = await rtlGenerator({
inputFiles: ['./ltr/style.css']
});
Write rtl to a new css file
var rtlGenerator = require('rtl-generator');
const result = await rtlGenerator({
inputFiles: ['./ltr/style.css', './ltr/style-more.css'],
outputFile: './ltr/style-rtl-combined.css'
});
You can skip the lines which you do not want to be converted by placing a special directive above the desired property.
Source:
p {
/*skip-rtl-conversion-below-line*/
float: left;
text-direction: left;
}
Output:
.rtl p {
text-direction: right;
}
Source:
.margin-of-four {
margin: 0 10px 40px 20px;
}
.margin-both {
margin-left: 5px;
margin-right: 10px;
}
@media (min-width: 576px) {
.header_top .col-sm-6:first-child {
display: inline-block;
float: left;
}
.header_top .col-sm-6:last-child {
display: inline-block;
float: right;
}
}
@media all and (min-width: 992px) and (max-width: 1199px) and (max-width: 480px) {
.list-group-horizontal-sm {
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
}
.list-group-horizontal-sm .list-group-item+.list-group-item.active {
margin-left: -1px;
border-left-width: 1px;
}
}
Output:
.rtl .margin-of-four {
margin: 0 20px 40px 10px;
}
.rtl .margin-both {
margin-right: 5px;
margin-left: 10px;
}
@media (min-width: 576px) {
.rtl .header_top .col-sm-6:first-child {
float: right;
}
.rtl .header_top .col-sm-6:last-child {
float: left;
}
}
@media all and (min-width: 992px) and (max-width: 1199px) and (max-width: 480px) {
.rtl .list-group-horizontal-sm .list-group-item+.list-group-item.active {
margin-right: -1px;
margin-left: unset;
border-right-width: 1px;
border-left-width: unset;
}
}
@author Hasan Hameed
FAQs
A utility to convert any existing left-to-right written css files into right-to-left css automatically.
We found that rtl-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.