- Copy and paste
rtl.config.jsfile. - Add packages to the
package.jsonfile (copy them from the package.json) below and re-install packages withyarncommand. - Run the command:
yarn run webpack --config webpack-rtl.config.js - In the file
src/index.tsxfile comment rows [18, 19]:// import './_metronic/assets/sass/plugins.scss'// import './_metronic/assets/sass/style.scss' - In the file
src/index.tsxadd the row:import './_metronic/assets/css/style.rtl.css'(! before style.react.scss). - In the file
public/index.htmlupdate the html tag with:<html direction="rtl" dir="rtl" style="direction: rtl"> - Find and replace next attributes in the project:
data-kt-menu-placement='bottom-start' => data-kt-menu-placement='bottom-end'data-kt-menu-placement='right-start' => data-kt-menu-placement='left-start' - In the file
src/_metronic/layout/components/header/MenuInnerWithSub.tsxadd the type 'left-start' to the 'menuPlacement' property:menuPlacement?: 'right-start' | 'bottom-start' | 'left-start' - In the file
demo1/src/_metronic/layout/components/header/MenuInner.tsxupdate all 'right-start' to 'left-start'
Last active
April 3, 2025 21:58
-
-
Save carmelodevuz/9ee0d92db7bd15c3612e25356139c4f9 to your computer and use it in GitHub Desktop.
Metronic React v8.1.2 - RTL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| "devDependencies": { | |
| ... | |
| "@types/sass-loader": "8.0.3", | |
| "css-loader": "6.7.1", | |
| "del": "6.0.0", | |
| "mini-css-extract-plugin": "2.6.1", | |
| "rtlcss-webpack-plugin": "4.0.7", | |
| "sass-loader": "13.0.2", | |
| "webpack": "5.74.0", | |
| "webpack-cli": "4.10.0" | |
| } | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const path = require('path') | |
| const del = require('del') | |
| const MiniCssExtractPlugin = require('mini-css-extract-plugin') | |
| const RtlCssPlugin = require('rtlcss-webpack-plugin') | |
| // global variables | |
| const rootPath = path.resolve(__dirname) | |
| const distPath = rootPath + '/src/_metronic/assets' | |
| const entries = { | |
| 'css/style': './src/_metronic/assets/sass/style.scss', | |
| } | |
| // remove older folders and files | |
| ;(async () => { | |
| await del(distPath + '/css', {force: true}) | |
| })() | |
| module.exports = { | |
| mode: 'development', | |
| stats: 'verbose', | |
| performance: { | |
| hints: 'error', | |
| maxAssetSize: 10000000, | |
| maxEntrypointSize: 4000000, | |
| }, | |
| entry: entries, | |
| output: { | |
| // main output path in assets folder | |
| path: distPath, | |
| // output path based on the entries' filename | |
| filename: '[name].js', | |
| }, | |
| resolve: { | |
| extensions: ['.scss'], | |
| }, | |
| plugins: [ | |
| new MiniCssExtractPlugin({ | |
| filename: '[name].rtl.css', | |
| }), | |
| new RtlCssPlugin({ | |
| filename: '[name].rtl.css', | |
| }), | |
| { | |
| apply: (compiler) => { | |
| // hook name | |
| compiler.hooks.afterEmit.tap('AfterEmitPlugin', () => { | |
| ;(async () => { | |
| await del(distPath + '/css/*.js', {force: true}) | |
| })() | |
| }) | |
| }, | |
| }, | |
| ], | |
| module: { | |
| rules: [ | |
| { | |
| test: /\.scss$/, | |
| use: [ | |
| MiniCssExtractPlugin.loader, | |
| 'css-loader', | |
| { | |
| loader: 'sass-loader', | |
| options: { | |
| sourceMap: true, | |
| }, | |
| }, | |
| ], | |
| }, | |
| ], | |
| }, | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment