cssjanus / cssjanus
Convert CSS stylesheets between left-to-right and right-to-left.
v2.2.0
2024-07-23 21:16 UTC
Requires
- php: >=7.4.0
Requires (Dev)
- mediawiki/mediawiki-codesniffer: 43.0.0
- mediawiki/mediawiki-phan-config: 0.14.0
- php-parallel-lint/php-parallel-lint: 1.3.2
- phpunit/phpunit: 9.6.16
README
CSSJanus
Convert CSS stylesheets between left-to-right and right-to-left.
Usage
transform( string $css, bool $swapLtrInURL = false, bool $swapLeftInURL = false ) : string
Parameters;
$css
(string) Stylesheet to transform.$swapLtrInURL
(boolean) Swapltr
tortl
direction in URLs.$swapLeftInURL
(boolean) Swapleft
andright
edges in URLs.
Example:
$rtlCss = CSSJanus::transform( $ltrCss );
Preventing flipping
If a rule is not meant to be flipped by CSSJanus, use a /* @noflip */
comment to protect the rule.
.rule1 { /* Will be converted to margin-right */ margin-left: 1em; } /* @noflip */ .rule2 { /* Will be preserved as margin-left */ margin-left: 1em; }
Port
This is a PHP port of the Node.js implementation of CSSJanus. Feature requests and bugs related to the actual CSS transformation logic or test cases of it, should be submitted upstream at https://github.com/cssjanus/cssjanus.
CSSJanus was originally a Google project.
Contribute
- Issue tracker: https://phabricator.wikimedia.org/tag/cssjanus/
- Source code: https://gerrit.wikimedia.org/g/mediawiki/libs/php-cssjanus
- Submit patches via Gerrit: https://www.mediawiki.org/wiki/Developer_account