2017 © Pedro Peláez
 

library cssjanus

Convert CSS stylesheets between left-to-right and right-to-left.

image

cssjanus/cssjanus

Convert CSS stylesheets between left-to-right and right-to-left.

  • Sunday, May 20, 2018
  • by bd808
  • Repository
  • 9 Watchers
  • 15 Stars
  • 255,885 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 6 Forks
  • 2 Open issues
  • 8 Versions
  • 5 % Grown

The README.md

Packagist, (*1)

CSSJanus

Convert CSS stylesheets between left-to-right and right-to-left., (*2)

Usage

transform( string $css, bool $swapLtrInURL = false, bool $swapLeftInURL = false ) : string

Parameters;, (*3)

  • $css (string) Stylesheet to transform.
  • $swapLtrInURL (boolean) Swap ltr to rtl direction in URLs.
  • $swapLeftInURL (boolean) Swap left and right edges in URLs.

Example:, (*4)

$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., (*5)

.rule1 {
  /* Will be converted to margin-right */
  margin-left: 1em;
}
/* @noflip */
.rule2 {
  /* Will be preserved as margin-left */
  margin-left: 1em;
}

CSS Logical Properties

We encourage and recommend use of CSS logical properties for the subset of CSS features where a native direction-aware version of a CSS property exists (be sure to check browser support for specific properties). You can, for example, set properties like margin-inline-start instead of margin-left, which the browser flips based on content direction, and work seamlessly alongside other CSS properties that CSSJanus flips instead., (*6)

Note that CSS logical properties flip based on nearest content direction and content language, whereas CSSJanus is generally configured to flip by user language and UI direction., (*7)

Port

CSSJanus was originally a Google project created by Lindsey Simon in 2008, written in Python. It was ported to PHP by Roan Kattouw in 2010 for use in MediaWiki, and ported to Node.js by Trevor Parscal in 2012., (*8)

As of 2014, the canonical specification and reference implementation is node-cssjanus, which is then ported to PHP after each release., (*9)

Contribute

The Versions

20/05 2018

dev-master

9999999-dev

Convert CSS stylesheets between left-to-right and right-to-left.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5.9

 

The Development Requires

by Trevor Parscal
by Roan Kattouw
by Timo Tijhof

16/02 2018

v1.2.1

1.2.1.0

Convert CSS stylesheets between left-to-right and right-to-left.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5.9

 

The Development Requires

by Trevor Parscal
by Roan Kattouw
by Timo Tijhof

14/02 2018

dev-benchmark

dev-benchmark

Convert CSS stylesheets between left-to-right and right-to-left.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5.9

 

The Development Requires

by Trevor Parscal
by Roan Kattouw
by Timo Tijhof

14/03 2017

v1.2.0

1.2.0.0

Convert CSS stylesheets between left-to-right and right-to-left.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4

 

The Development Requires

24/12 2016

v1.1.3

1.1.3.0

Convert CSS stylesheets between left-to-right and right-to-left.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.3

 

The Development Requires

15/06 2015

v1.1.2

1.1.2.0

Convert CSS stylesheets between left-to-right and right-to-left.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.3

 

The Development Requires

14/11 2014

v1.1.1

1.1.1.0

Convert CSS stylesheets between left-to-right and right-to-left.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.3

 

The Development Requires

26/09 2014

v1.1.0

1.1.0.0

Convert CSS stylesheets between left-to-right and right-to-left.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.3

 

The Development Requires