Skip to content

Instantly share code, notes, and snippets.

@nelson6e65
Created April 6, 2020 03:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nelson6e65/85610035751af719fb355431b35ff5bf to your computer and use it in GitHub Desktop.
Save nelson6e65/85610035751af719fb355431b35ff5bf to your computer and use it in GitHub Desktop.
@function dasherize($string) {
$progress: str-slice($string, 2);
$result: str-slice($string, 1, 1);
@while str-length($progress) > 0 {
$char: str-slice($progress, 1, 1);
$mayus: to-upper-case($char);
@if ($char == $mayus) {
$result: $result + "-" + $char;
}
@else {
$result: $result + $char;
}
$progress: str-slice($progress, 2);
}
@return to-lower-case($result);
}
@nelson6e65
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment