Skip to content

Commit

Permalink
Merge pull request #4265 from pat270/clay-4252
Browse files Browse the repository at this point in the history
 feat(@clayui/css): Mixins `clay-css` should output any CSS Custom Properties passed into it
  • Loading branch information
matuzalemsteles authored Sep 13, 2021
2 parents 5bb0100 + a78ddfa commit f6a1f7e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/clay-css/src/scss/functions/_global-functions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,20 @@
@return max($val1, $val2);
}

/// A function that determines whether the string `$str1` begins with the characters of the specified string `$str2`. This returns `true` if `$str1` begins with `$str2`.
/// @param {String} $str1 - The string to search.
/// @param {String} $str2 - The search parameter.

@function starts-with($str1, $str2) {
$returnVal: false;

@if (str-index($str1, $str2) == 1) {
$returnVal: true;
}

@return $returnVal;
}

// * REUSE-Snippet-Begin
// * SPDX-License-Identifier: MIT
// * SPDX-FileCopyrightText: © 2016 Hugo Giraudel <https://hugogiraudel.com/>
Expand Down
4 changes: 4 additions & 0 deletions packages/clay-css/src/scss/mixins/_globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@
$value: null;
}

@if (starts-with($key, '--')) {
#{$key}: $value;
}

@if ($key == 'appearance') {
-moz-appearance: $value;
-webkit-appearance: $value;
Expand Down

0 comments on commit f6a1f7e

Please sign in to comment.