Usage Guide

Your guide on how to use and make the most out of RTLCSS

Time is Priceless, Caffeine is Not! Buy Me a Coffee โ˜•

Value Directives

Value directives are placed any where inside the declaration value. They target the containing declaration node.

NameSyntaxDescription
Append/*rtl:append:{value}*/Appends {value} to the end of the declaration value.
Ignore/*rtl:ignore*/Ignores processing of this declaration.
Insert/*rtl:insert:{value}*/Inserts {value} to where the directive is located inside the declaration value.
Prepend/*rtl:prepend:{value}*/Prepends {value} to the begining of the declaration value.
Replace/*rtl:{value}*/Replaces the declaration value with {value}.

ยงAppend

SyntaxDescription
/*rtl:append:{value}*/Appends {value} to the end of the declaration value.

ยงExample

.sample {
  transform:rotate(45deg) /*rtl:append:scaleX(-1)*/;
}

ยงIgnore

SyntaxDescription
/*rtl:ignore*/Ignores processing of this declaration.

ยงExample

.code {
  direction:ltr/*rtl:ignore*/;
}

ยงInsert

SyntaxDescription
/*rtl:insert:{value}*/Inserts {value} to where the directive is located inside the declaration value.

ยงPrepend

SyntaxDescription
/*rtl:prepend:{value}*/Prepends {value} to the begining of the declaration value.

ยงExample

.example {
   font-family:"Droid Sans", "Helvetica Neue", Arial/*rtl:prepend:"Droid Arabic Kufi",*/;
}

ยงReplace

SyntaxDescription
/*rtl:{value}*/Replaces the declaration value with {value}.

ยงExample

.example {
   font-size:16px/*rtl:14px*/;
}

ยงTip

SASS/SCSS omit multi-line comments from the compiled CSS in compressed mode. https://sass-lang.com/documentation/syntax/comments#in-scss
However, If a comment begins with /*!, though, it will always be included in the CSS output.

SASS/SCSS will will also omit comments placed inside the declaration value from the output CSS.

To preserve RTLCSS value directives, Use SASS interpolation syntax passing your comment as string.

.example {
  font-size:16px #{"/*!rtl:14px;*/"};
}

Moreover, depending on your setup the ending semicolon may get stripped from last declaration. Which will decouple it from the value directive.

To work around this, either ensure the last declaration has an ending semicolon or place the value directive before the declaration value.

.example {
  font-size: #{"/*!rtl:14px*/"}16px
}

PREVNEXT