Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automated RTL support #3844

Merged
merged 9 commits into from
Dec 7, 2017
Merged

Add automated RTL support #3844

merged 9 commits into from
Dec 7, 2017

Conversation

yoavf
Copy link
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
Contributor

Whoa what serendipitous timing! CC @youknowriad 😉

@yoavf
Copy link
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
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
@@ -484,7 +488,11 @@ function gutenberg_replace_default_add_new_button() {
display: block;
top: 0;
margin: -1px 0;
<?php if ( is_rtl() ) : ?>
Copy link
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
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
Contributor

This is absolutely the better approach! Thanks Yoav.

Copy link
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
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