I wrote @each
loop to generate text-decoration
styling but I ran into a problem. You can see below.
$args: underline, overline, underline dashed, underline double, underline dotted, underline wavy,
underline overline;
@each $arg in $args {
.text-decoration-#{$arg} {
text-decoration: $arg;
}
}
OUTPUT I AM GETTING
.text-decoration-underline {
text-decoration: underline;
}
.text-decoration-overline {
text-decoration: overline;
}
.text-decoration-underline dashed {
-webkit-text-decoration: underline dashed;
text-decoration: underline dashed;
}
.text-decoration-underline double {
-webkit-text-decoration: underline double;
text-decoration: underline double;
}
.text-decoration-underline dotted {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
}
.text-decoration-underline wavy {
-webkit-text-decoration: underline wavy;
text-decoration: underline wavy;
}
.text-decoration-underline overline {
text-decoration: underline overline;
}
OUTPUT I WANT
I want to replace space
with hyphens -
instead. If I add hyphens in argument it will conflict text-decoration
value;
.text-decoration-underline {
text-decoration: underline;
}
.text-decoration-overline {
text-decoration: overline;
}
.text-decoration-underline-dashed {
-webkit-text-decoration: underline dashed;
text-decoration: underline dashed;
}
.text-decoration-underline-double {
-webkit-text-decoration: underline double;
text-decoration: underline double;
}
.text-decoration-underline-dotted {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
}
.text-decoration-underline-wavy {
-webkit-text-decoration: underline wavy;
text-decoration: underline wavy;
}
.text-decoration-underline-overline {
text-decoration: underline overline;
}