JavaScripting

The definitive source of the best
JavaScript libraries, frameworks, and plugins.


  • ×

    ↔️ Convert CSS stylesheets between left-to-right and right-to-left.              Made by Wikimedia.
    Filed under 

    • 🔾23%Overall
    • 193
    • 33.3 days
    • 🕩54
    • 👥13

    Build Status Coverage Status npm Tested with QUnit

    CSSJanus

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

    Based the original Google project.

    See Interactive demo.

    Install

    npm install cssjanus
    

    Usage

    var cssjanus = require( 'cssjanus' );
    var rtlCss = cssjanus.transform( ltrCss );
    
    transform( string css [, Object options ] ) : string
    

    Parameters:

    • css Stylesheet to transform
    • options: Options object (optional)
      • options.transformDirInUrl (Boolean): Transform directions in URLs, such as ltr to rtl. Default: false.
      • options.transformEdgeInUrl (Boolean): Transform edges in URLs, such as left to right. Default: false.

    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;
    }
    

    Integrations

    Who uses CSSJanus?

    See also

    Show All