RTLCSS is a robust framework for transforming Left-To-Right (LTR) Cascading Style Sheets (CSS) into Right-To-Left (RTL) stylesheets. It enables developers to internationalize web interfaces for RTL languages with minimal manual effort by automatically flipping directional properties (e.g., `left` to `right`, `margin-left` to `margin-right`). The current stable version is 4.3.0, with a focus on stability and compatibility. It operates as a PostCSS plugin, leveraging PostCSS's AST manipulation capabilities, and supports various control directives and a plugin architecture for custom transformations. Key differentiators include its extensive directive support for fine-grained control over transformations, a flexible plugin API, and a clear upgrade path across major versions, primarily driven by PostCSS updates.
npm install rtlcssVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to use `rtlcss` as a PostCSS plugin to transform an LTR CSS string into an RTL equivalent, including basic options and directives.
Upgrade Node.js to version 12.0.0 or higher. Ensure PostCSS is installed at version 8 or later in your project dependencies.
Refer to the RTLCSS v2.0 documentation for updated configuration schemas and option definitions when migrating from v1.x.
Always use `rtlcss` via `postcss([rtlcss()])` or similar PostCSS integration methods.
Use `import postcss from 'postcss';` for ESM or `const postcss = require('postcss');` for CommonJS.Install PostCSS: `npm install postcss` or `yarn add postcss`.
Ensure your Node.js environment meets the minimum requirement of `node >=12.0.0` as specified in `rtlcss` v3.0.0 and above. Upgrade Node.js if necessary.