Skip to content

Commit

Permalink
Add missing sass mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
tnajdek committed Jun 23, 2021
1 parent 28c11f0 commit 207cb6f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/scss/abstracts/_functions.scss
Expand Up @@ -3,3 +3,4 @@
//

@import "functions/asset-url";
@import "functions/strings";
32 changes: 32 additions & 0 deletions src/scss/abstracts/functions/_strings.scss
@@ -0,0 +1,32 @@
//
// String functions
// --------------------------------------------------

@use "sass:selector";

@function str-replace($string, $token, $replace: "") {
$i: str-index($string, $token);

@while (str-index($string, $token) != null) {
$first-part: str-slice($string, 1, ($i - 1));
$last-part: str-slice($string, ($i + str-length($token)));
$string: str-slice($string, 1, ($i - 1)) + $replace + $last-part;

$i: str-index($string, $token);
}

@return $string;
}

@function str-parse($string, $token) {
$i: str-index($string, $token);

@if $i {
$first-part: str-slice($string, 1, ($i - 1));
$string: str-parse(str-slice($string, ($i + str-length($token))), $token);
@debug $first-part;
@return join(selector.simple-selectors($first-part), $string);
}

@return selector.simple-selectors($string);
}

0 comments on commit 207cb6f

Please sign in to comment.