1.2.1 • Published 7 years ago

wsp-plugin-rtl v1.2.1

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

wsp-plugin-rtl

A wix-style-processor plugin that transforms CSS direction expressions, based on a given RTL/LTR parameter.

Installation

$ npm i -S wsp-plugin-rtl

Usage

ExpressionRTLLTR
STARTrightleft
ENDleftright
STARTSIGN'''-'
ENDSIGN'-'''
DEG-START1800
DEG-END0180
DIRrtlltr
CSS
.my-selector {
    padding-START: 9px;   /* START will be replaced with left / right, given rtl = false / true */
    float: START;         /* Same as above, applied to the value */
    padding-END: 9px;     /* END will be replaced with left / right, given rtl = true / false */
    direction: DIR;     /* DIR will be replaced with ltr / rtl, given rtl = false / true */
    margin: STARTSIGN5px; /* STARTSIGN will be replaced with -, given rtl = false, and will be removed for rtl = true */
    margin: ENDSIGN5px;   /* ENDSIGN will be replaced with -, given rtl = true, and will be removed for rtl = false */
    transform: rotate(DEG-STARTdeg);
    transform: rotate(DEG-ENDdeg);
}
Plugin initialization
import styleProcessor from 'wix-style-processor';
import RtlPlugin from 'wsp-plugin-rtl';

const isRtl = true; //or false for LTR
const rtlPlugin = RtlPlugin(isRtl);

$(document).ready(() => {
    styleProcessor.plugins.addDeclarationReplacer(rtlPlugin);
    styleProcessor.init().then(() => {
            //start rendering your application here - otherwise your app will flicker
        });
});
1.2.1

7 years ago

1.2.0

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago