Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Convert CSS stylesheets between left-to-right and right-to-left
JavaScript
Tree: 698437ab03

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.travis.yml
Readme.md
package.json

Readme.md

build status

CSSJanus

Converts CSS stylesheets between left-to-right and right-to-left. This is a JavaScript port for Node.js of CSSJanus, which is written in python.

Install

npm install cssjanus

Basic usage

var cssjanus = require( 'cssjanus' );
var 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

Something went wrong with that request. Please try again.