realJsNinja / cssjanus

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CSSJanus

Converts CSS stylesheets between left-to-right and right-to-left. This is a C# port for .Net of CSSJanus, which is written in python.

Basic usage

CssJanus cssJanus = new CssJanus();
string rtlCss = cssjanus.Transform( ltrCss );

Advanced usage

Transform( css, swapLtrRtlInUrl, swapLeftRightInUrl )

  • css (String) Stylesheet to transform
  • swapLtrRtlInUrl (Boolean) Swap 'ltr' and 'rtl' in URLs
  • swapLeftRightInUrl (Boolean) Swap 'left' and 'right' in URLs

Preventing flipping

Use a /* @noflip */ comment to protect a rule from being changed.

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

Additional Resources

About

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

License:Apache License 2.0


Languages

Language:C# 100.0%