Gathering detailed insights and metrics for stylis-rtlcss
Gathering detailed insights and metrics for stylis-rtlcss
Gathering detailed insights and metrics for stylis-rtlcss
Gathering detailed insights and metrics for stylis-rtlcss
tiny styled-components plugin converts LTR to RTL, based on RTLCSS
npm install stylis-rtlcss
Typescript
Module System
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
11 Stars
22 Commits
2 Watchers
4 Branches
1 Contributors
Updated on Jan 30, 2024
Latest Version
2.1.1
Package Id
stylis-rtlcss@2.1.1
Unpacked Size
7.22 kB
Size
2.72 kB
File Count
5
NPM Version
6.14.5
Node Version
12.18.3
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
6
1yarn add stylis-rtlcss
1npm i stylis-rtlcss
1import styled, { StyleSheetManager } from "styled-components"; 2import rtlcss from "stylis-rtlcss"; 3 4const StyledDiv = styled.div` 5 margin-left: 10px; 6`; 7 8class App extends Component { 9 render() { 10 return ( 11 <StyleSheetManager stylisPlugins={[rtlcss]}> 12 <StyledDiv>Margin will be on RIGHT!</StyledDiv> 13 </StyleSheetManager> 14 ); 15 } 16}
to avoid typing issues in StyleSheetManager
while using Typescript, you should conditionally render props
1import styled, { StyleSheetManager } from "styled-components"; 2import rtlcss from "stylis-rtlcss"; 3 4const StyledDiv = styled.div` 5 margin-left: 10px; 6`; 7 8class App extends Component { 9 render() { 10 const { language } = this.props; 11 return ( 12 <StyleSheetManager {...(language === 'ar' ? { stylisPlugins: [rtlcss] } : {})} 13 <StyledDiv>Margin will be on RIGHT!</StyledDiv> 14 </StyleSheetManager> 15 ) 16 } 17}
<StyleSheetManager>
. So,
in .babelrc
file, set minify
to false
1{ 2 "plugins": [ 3 [ 4 "babel-plugin-styled-components", 5 { 6 "minify": false 7 } 8 ] 9 ] 10}
Then you can use control Directives as you want
Control directives are placed between declarations or statements (rules and at-rules). They can target a single node (self-closing) or a set of nodes (block-syntax).
1import styled, { StyleSheetManager } from "styled-components"; 2import rtlcss from "stylis-rtlcss"; 3 4const StyledDiv = styled.div` 5 /*rtl:ignore*/ 6 margin-left: 10px; 7`; 8 9class App extends Component { 10 render() { 11 return ( 12 <StyleSheetManager stylisPlugins={[rtlcss]}> 13 <StyledDiv>Margin stills on LEFT!</StyledDiv> 14 </StyleSheetManager> 15 ); 16 } 17}
Directive Syntax | Description |
---|---|
/*rtl:ignore*/ | Ignores processing of the following node (self-closing) or nodes within scope (block-syntax). |
/*rtl:remove*/ | Removes the following node (self-closing) or nodes within scope (block-syntax). |
Value directives are placed any where inside the declaration value. They target the containing declaration node.
1import styled, { StyleSheetManager } from "styled-components"; 2import rtlcss from "stylis-rtlcss"; 3 4const StyledDiv = styled.div` 5 margin-left: 10px /*rtl:ignore*/; 6`; 7 8class App extends Component { 9 render() { 10 return ( 11 <StyleSheetManager stylisPlugins={[rtlcss]}> 12 <StyledDiv>Margin stills on LEFT!</StyledDiv> 13 </StyleSheetManager> 14 ); 15 } 16}
Directive Syntax | Description | Example |
---|---|---|
/*rtl:prepend:{value}*/ | Ignores processing of this declaration. | transform:rotate(45deg) /*rtl:append:scaleX(-1)*/; |
/*rtl:{value}*/ | Replaces the declaration value with {value}. | font-size:16px/*rtl:14px*/; |
Licensed under the MIT License
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
9 existing vulnerabilities detected
Details
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/22 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More