Flip css/scss direction from ltr to rtl or rtl to ltr with single line php code!
Install this package via Composer.
composer require penobit/css-flip
You can also download latest release from Github and include src/CSSFlip.php
manually but i recommend using composer to stay up to date and easier install and usage
Create CSSFlip object
use Penobit\CSSFlip\CSSFlip;
$cssFlip = new CSSFlip();
$cssCode = <<<CSS
body{
direction: ltr;
}
div{
text-align:left;
margin-left: 20px;
margin-right: 2rem;
}
span{
padding: 10px 15px 20px 25px;
}
CSS;
$flippedCssCode = $cssFlip->transform($cssCode);
/*
# Output of above code will be
body{
direction: rtl;
}
div{
text-align:right;
margin-right: 20px;
margin-left: 2rem;
}
span{
padding: 10px 15px 20px 25px;
padding: 10px 25px 20px 15px;
}
*/