diff --git a/lib/client-assets.php b/lib/client-assets.php index 4625b818354..af09d6be945 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -110,6 +110,7 @@ function wc_admin_register_script() { array( 'wp-edit-blocks' ), filemtime( wc_admin_dir_path( 'dist/components/style.css' ) ) ); + wp_style_add_data( 'wc-components', 'rtl', 'replace' ); wp_register_style( 'wc-components-ie', @@ -117,6 +118,7 @@ function wc_admin_register_script() { array( 'wp-edit-blocks' ), filemtime( wc_admin_dir_path( 'dist/components/ie.css' ) ) ); + wp_style_add_data( 'wc-components-ie', 'rtl', 'replace' ); wp_register_style( WC_ADMIN_APP, @@ -124,6 +126,7 @@ function wc_admin_register_script() { array( 'wc-components' ), filemtime( wc_admin_dir_path( "dist/{$entry}/style.css" ) ) ); + wp_style_add_data( WC_ADMIN_APP, 'rtl', 'replace' ); } add_action( 'admin_enqueue_scripts', 'wc_admin_register_script' ); diff --git a/package.json b/package.json index ba557d9aad2..e234e8e802f 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,8 @@ "stylelint": "9.9.0", "stylelint-config-wordpress": "13.1.0", "webpack": "4.28.3", - "webpack-cli": "3.1.2" + "webpack-cli": "3.1.2", + "webpack-rtl-plugin": "github:yoavf/webpack-rtl-plugin#develop" }, "dependencies": { "@fresh-data/framework": "^0.5.1", diff --git a/packages/components/src/chart/style.scss b/packages/components/src/chart/style.scss index b922778c4c3..cfa9d89f3c5 100644 --- a/packages/components/src/chart/style.scss +++ b/packages/components/src/chart/style.scss @@ -79,16 +79,6 @@ margin-top: -8px; } - .rtl & { - margin: 0 auto 0 0; - border-right: 0; - border-left: 1px solid $core-grey-light-700; - - @include breakpoint( '<782px' ) { - border-left: 0; - } - } - @include breakpoint( '<782px' ) { border-right: 0; min-height: 0; diff --git a/packages/components/src/table/style.scss b/packages/components/src/table/style.scss index f394e77b980..42f16f2bce9 100644 --- a/packages/components/src/table/style.scss +++ b/packages/components/src/table/style.scss @@ -214,10 +214,6 @@ &:not(.is-left-aligned) { text-align: right; - .rtl & { - text-align: left; - } - button { justify-content: flex-end; } @@ -255,11 +251,6 @@ th.woocommerce-table__item { & + .woocommerce-table__header { border-left: 1px solid $core-grey-light-700; - - .rtl & { - border-left: 0; - border-right: 1px solid $core-grey-light-700; - } } &.is-left-aligned.is-sortable { @@ -281,10 +272,6 @@ th.woocommerce-table__item { background: transparent; box-shadow: none !important; - .rtl & { - padding: $gap-smaller 0 $gap-smaller $gap-large; - } - // @todo Add interactive styles &:hover { box-shadow: none !important; diff --git a/packages/components/src/view-more-list/style.scss b/packages/components/src/view-more-list/style.scss index 35c4e4cf53a..700d2974022 100644 --- a/packages/components/src/view-more-list/style.scss +++ b/packages/components/src/view-more-list/style.scss @@ -4,10 +4,6 @@ padding-left: 4px; margin: 0 0 0 $gap-smallest; vertical-align: middle; - - .rtl & { - margin: 0 $gap-smallest 0 0; - } } .woocommerce-view-more-list__popover { diff --git a/postcss.config.js b/postcss.config.js index a4b36752245..3993f9f9d28 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,6 +1,6 @@ module.exports = { plugins: [ - require( './node_modules/@wordpress/postcss-themes' )( { + require( '@wordpress/postcss-themes' )( { // @todo A default is required for now. Fix postcss-themes to allow no default defaults: { primary: '#0085ba', diff --git a/webpack.config.js b/webpack.config.js index acf8a4e841b..dda7e08da83 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -7,6 +7,7 @@ const { get } = require( 'lodash' ); const path = require( 'path' ); const CopyWebpackPlugin = require( 'copy-webpack-plugin' ); const { DefinePlugin } = require( 'webpack' ); +const WebpackRTLPlugin = require( 'webpack-rtl-plugin' ); /** * WordPress dependencies @@ -157,6 +158,9 @@ const webpackConfig = { return outputPath; }, } ), + new WebpackRTLPlugin( { + suffix: '-rtl', + } ), new MiniCssExtractPlugin( { filename: './dist/[name]/style.css', } ),