Skip to content

Instantly share code, notes, and snippets.

@ilicmarko
Last active January 14, 2022 16:06
Show Gist options
  • Save ilicmarko/95457dc605816c6f4f8ffde61fcd9d4a to your computer and use it in GitHub Desktop.
Save ilicmarko/95457dc605816c6f4f8ffde61fcd9d4a to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// Proveri da li je RTL mode.
@function is-rtl() {
@return $global-text-direction == 'rtl';
}
// Okreni levu ili desnu stranu
@function invert($side) {
@return if($side == 'left', 'right', 'left'); // Ovo je kao ternari operator
}
// Dodaj spacing
@mixin spacing($side, $size) {
$side: if(is-rtl(), invert($side), $side);
margin-#{$side}: $size;
}
// Regular Mode
$global-text-direction: 'ltr';
.header {
@include spacing('right', 10px);
}
// RTL Mode
$global-text-direction: 'rtl';
.header {
@include spacing('right', 10px);
}
.header {
margin-right: 10px;
}
.header {
margin-left: 10px;
}
{
"sass": {
"compiler": "dart-sass/1.32.12",
"extensions": {},
"syntax": "SCSS",
"outputStyle": "expanded"
},
"autoprefixer": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment