postcss-rtlcss is a PostCSS plugin designed to simplify the creation of Cascading Style Sheets (CSS) that support both Left-To-Right (LTR) and Right-To-Left (RTL) reading directions. It leverages the RTLCSS library internally to transform CSS rules. The current stable version is 6.0.0. The project maintains a regular release cadence, including minor versions for features and bug fixes, and major versions for significant underlying technical changes (such as transpilation target updates or Node.js engine requirements). Its key differentiators include the ability to generate a single CSS file containing rules for both directions (the recommended "combined mode") or a minimal override file, offering flexibility in implementing multilingual and internationalization efforts for web development. It integrates seamlessly into standard PostCSS workflows and build tools like Webpack.
npm install postcss-rtlcssVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to use `postcss-rtlcss` with PostCSS to transform LTR CSS into a combined LTR/RTL output, including option configuration for a practical example.
Ensure your project's JavaScript runtime environment or build configuration (e.g., Babel presets) supports ES6 (ECMAScript 2015) features. If not, consider locking to a `postcss-rtlcss` version prior to 6.0.0 or configuring your build process to transpile ES6 output further down.
Upgrade your Node.js environment to version 18.0.0 or newer. Alternatively, if upgrading Node.js is not feasible, downgrade `postcss-rtlcss` to a compatible version (e.g., `5.x.x`).
Ensure your project uses a `postcss` version compatible with the peer dependency range specified in `postcss-rtlcss`. Install `postcss@^8.4.21` if you encounter issues.
Switch to ESM import syntax: `import postcssRTLCSS from 'postcss-rtlcss';`. Ensure your project's module system is configured for ESM.
Use the correct ESM named import from the subpath: `import { Mode, Source } from 'postcss-rtlcss/options';`.Update your Node.js installation to version 18.0.0 or a later compatible version. Check your `package.json` `engines` field and CI/CD configurations.