承接 wikimedia/cssjanus 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wikimedia/cssjanus

最新稳定版本:v2.3.0

Composer 安装命令:

composer require wikimedia/cssjanus

包简介

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

README 文档

README

Packagist

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) Swap ltr to rtl direction in URLs.
  • $swapLeftInURL (boolean) Swap left and right 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;
}

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.

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.

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.

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

Contribute

统计信息

  • 总下载量: 330.09k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 19
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2026-01-04