RTL CSS Transform Webpack Plugin 💎
Webpack plugin that implements RTLCSS framework for transforming Left-To-Right (LTR) Cascading Style Sheets (CSS) to Right-To-Left (RTL).
Before you should use a CSS extraction plugin. For Webpack v4 we use mini-css-extract-plugin to extract CSS from JS.
rtl-css-transform-webpack-plugin
creates RTL CSS file per LTR CSS file:
style.css
style.rtl.css
Features 😛
- Full RTLCSS options, plugins & hooks support
- CSS modules & Code splitting compatible
- Source map for debugging
- Support Webpack v4
Install
npm install rtl-css-transform-webpack-plugin --save-dev
Usage
const MiniCssExtractPlugin = ;const RtlCssPlugin = ; moduleexports = entry: path output: path: path filename: "[name].js" chunkFilename: "[name].js" // only for code splitting plugins: module: rules: test: /\.css$/ use: MiniCssExtractPluginloader "css-loader"
Filename
This option determines the name of each output bundle.
The default file name is [name].rtl.css
.
See webpack output filename for more details.
filename: "rtl/[chunkhash].css"
Sourcemap
Produces inline source map. Disabled by default.
Source mapping can be enabled via sourcemap
option.
sourcemap: true
Alternatively it can be enabled using webpack devtool option.
webpack --devtool source-map
Minimize
Using built-in webpack optimization via production option.
webpack -p
Alternatively see mini-css-extract-plugin optimization recommendation.
RTLCSS options
RTLCSS usage can be customized using object config.
Options are same as RTLCSS options.
Plugins are same as RTLCSS plugins.
Hooks are same as RTLCSS hooks.
config: options: {} plugins: hooks: {}
💐 Special thanks to @MohammadYounes for RTLCSS.