Skip to content

Add automated RTL support#3844

Merged
youknowriad merged 9 commits intoWordPress:masterfrom
yoavf:add/rtl
Dec 7, 2017
Merged

Add automated RTL support#3844
youknowriad merged 9 commits intoWordPress:masterfrom
yoavf:add/rtl

Conversation

@yoavf
Copy link
Copy Markdown
Contributor

@yoavf yoavf commented Dec 7, 2017

Description

The current RTL experience with Gutenberg is broken, and there's no reason to try and maintain RTL css manually.

This adds automated generation of RTL CSS files using rtlcss via a slightly modified webpack-rtl-plugin. The modification to the plugin are described in this PR.

It also adds minor fixes for the new post button inline css.

How Has This Been Tested?

Confirmed that:

  • With these changes, npm run build will also build -rtl.css files.
  • Gutenberg looks good on a WP install running in Hebrew or Arabic

Screenshots (jpeg or gifs if applicable):

Before:
before
After:
after

Types of changes

Bug fix for current RTL CSS

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows has proper inline documentation.

yoavf added 5 commits December 7, 2017 12:45
We're going to autogenerate RTL css files, so this won't be needed
This currently loads the version from https://github.com/yoavf/webpack-rtl-plugin/tree/develop
This include a simple (but required) change, that's been requested upstream as a PR:
romainberger/webpack-rtl-plugin#15
This is done by adding style data - WP will automatically load the -rtl css files instead of the regular files in RTL mode.
@jasmussen
Copy link
Copy Markdown
Contributor

Whoa what serendipitous timing! CC @youknowriad 😉

@yoavf
Copy link
Copy Markdown
Contributor Author

yoavf commented Dec 7, 2017

Ha @jasmussen - I got started with this at WC US, and missed #3831 before pushing.

I think this method is preferable, since we don't end up with big LTR and RTL css files, and we use WP's built in style loading for RTL. If there's ever a decision to switch to having the CSS inline, then using postcss makes more sense.

Copy link
Copy Markdown
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work here! This approach is better indeed. We should also copy the "arrow icon" inverting from the other PR.

gutenberg.php Outdated
display: block;
top: 0;
margin: -1px 0;
<?php if ( is_rtl() ) : ?>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering about the indentation here, should it be aligned with the styling (like above) or not? We should probably be consistent anyway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 will fix

@jasmussen
Copy link
Copy Markdown
Contributor

This is absolutely the better approach! Thanks Yoav.

Copy link
Copy Markdown
Contributor

@jasmussen jasmussen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@youknowriad
Copy link
Copy Markdown
Contributor

Awesome work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants