Problem/Motivation
It's hard to support RTL styling. It's common for it to slip through our review process. See #1166886: [Policy, no patch] Improve RTL support
Proposed resolution
In #2222049: Add a .csslintrc file that's in line with our CSS standards we're working on making CSSlint a more formal part of our review process. If we can create a CSSlint rule that detects LTR styling, and possibly the absence of the equivalent RTL styling, we can make it much easier to catch during the review process and when writing the code using and inline linter.
Remaining tasks
Open an issue in the CSSlint github queue- https://github.com/CSSLint/csslint/issues/533Fork the repo and create the rule- https://github.com/lewisnyman/csslint/tree/ltr-detection- Submit a pull request
- Profit?
User interface changes
None
API changes
None
Comments
Comment #1
lewisnymanCreated issue https://github.com/CSSLint/csslint/issues/533
Comment #2
yesct commentedComment #3
lewisnymanWorking on the rule here, https://github.com/lewisnyman/csslint/tree/ltr-detection.
Hell is other project's coding standards :P
Comment #4
tim.plunkettComment #5
tsi commentedThat's an interesting direction. It would have to detect if the RTL rule is (not) in place, wouldn't it? and that would be a little too Drupal specific no?
In your rule on github it seems like your missing detection for the obvious 'direction' property, and the less obvious (and harder to detect) 'transform' property which might be LTR specific in some cases (e.g. off-canvas menus).
You might want to check out my CSS Flipper that does a similar detection and can actually automate the process of RTLing an LTR stylesheet (and vice-versa), it's not perfect but it gets you pretty close.
Comment #6
lewisnyman@tsi Would the best route for this be to contribute an RTL Assetic filter?
Comment #7
lewisnymanIn the Github issue someone recommended CSSJaunus PHP. Maybe this is something we could aim for in 8.1.x? We could include it using composer.
It looks like this was mentioned before but never discussed: https://groups.drupal.org/node/194488
Comment #8
lewisnymanPosted issue, this may become a won't fix: #2387765: Automate CSS RTL generation
Comment #20
mherchelClosing this in favor of #3314921: Add CSS logical properties to properties-order within .stylelintrc.json, and do some cleanup of unneeded properties . 10.1.x supports logical properties which makes RTL styling a lot easier.