diff options
author | Sam Potts <sam@potts.es> | 2020-04-11 16:23:14 +1000 |
---|---|---|
committer | Sam Potts <sam@potts.es> | 2020-04-11 16:23:14 +1000 |
commit | 502d5977d79148957828cbf313b7ef4c9f31973f (patch) | |
tree | 71bbffcffc9745c5b672a122f3937519ba67c1c4 /src/sass/lib/css-vars.scss | |
parent | 8f5b59c18cc7837bde9af55d24d12e1fd939043d (diff) | |
download | plyr-502d5977d79148957828cbf313b7ef4c9f31973f.tar.lz plyr-502d5977d79148957828cbf313b7ef4c9f31973f.tar.xz plyr-502d5977d79148957828cbf313b7ef4c9f31973f.zip |
Converted to 2 space indentation
Diffstat (limited to 'src/sass/lib/css-vars.scss')
-rw-r--r-- | src/sass/lib/css-vars.scss | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/src/sass/lib/css-vars.scss b/src/sass/lib/css-vars.scss index 493df3a8..fb30f3a7 100644 --- a/src/sass/lib/css-vars.scss +++ b/src/sass/lib/css-vars.scss @@ -11,12 +11,12 @@ $css-vars-use-native: false !default; // Assigns a variable to the global map /// @function css-var-assign($varName: null, $varValue: null) { - @return map-merge( - $css-vars, - ( - $varName: $varValue, - ) - ); + @return map-merge( + $css-vars, + ( + $varName: $varValue, + ) + ); } /// @@ -30,33 +30,33 @@ $css-vars-use-native: false !default; // background: var(--main-background, green); /// @function var($args...) { - // CHECK PARAMS - @if (length($args) ==0) { - @error 'Variable name is expected to be passed to the var() function'; - } - @if (str-length(nth($args, 1)) < 2 or str-slice(nth($args, 1), 0, 2) != '--') { - @error "Variable name is expected to start from '--'"; - } + // CHECK PARAMS + @if (length($args) ==0) { + @error 'Variable name is expected to be passed to the var() function'; + } + @if (str-length(nth($args, 1)) < 2 or str-slice(nth($args, 1), 0, 2) != '--') { + @error "Variable name is expected to start from '--'"; + } - // PROCESS - $var-name: nth($args, 1); - $var-value: map-get($css-vars, $var-name); + // PROCESS + $var-name: nth($args, 1); + $var-value: map-get($css-vars, $var-name); - @if ($css-vars-use-native) { - // CSS variables - // Native CSS: don't process function in case of native - @return unquote('var(' + $args + ')'); - } @else { - @if ($var-value == null) { - // variable is not provided so far - @if (length($args) == 2) { - $var-value: nth($args, 2); - } - } - - // Sass: return value from the map - @return $var-value; + @if ($css-vars-use-native) { + // CSS variables + // Native CSS: don't process function in case of native + @return unquote('var(' + $args + ')'); + } @else { + @if ($var-value == null) { + // variable is not provided so far + @if (length($args) == 2) { + $var-value: nth($args, 2); + } } + + // Sass: return value from the map + @return $var-value; + } } /// @@ -69,32 +69,32 @@ $css-vars-use-native: false !default; // )); /// @mixin css-vars($var-map: null) { - // CHECK PARAMS - @if ($var-map == null) { - @error 'Map of variables is expected, instead got: null'; - } - @if (type_of($var-map) != map) { - @error 'Map of variables is expected, instead got another type passed: #{type_of($var, ap)}'; - } + // CHECK PARAMS + @if ($var-map == null) { + @error 'Map of variables is expected, instead got: null'; + } + @if (type_of($var-map) != map) { + @error 'Map of variables is expected, instead got another type passed: #{type_of($var, ap)}'; + } - // PROCESS - @if ($css-vars-use-native) { - // CSS variables - // Native CSS: assign CSS custom properties to the global scope - @at-root :root { - @each $var-name, $var-value in $var-map { - @if (type_of($var-value) == string) { - #{$var-name}: $var-value; // to prevent quotes interpolation - } @else { - #{$var-name}: #{$var-value}; - } - } - } - } @else { - // Sass or debug - // merge variables and values to the global map (provides no output) - @each $var-name, $var-value in $var-map { - $css-vars: css-var-assign($varName, $varValue) !global; // store in global variable + // PROCESS + @if ($css-vars-use-native) { + // CSS variables + // Native CSS: assign CSS custom properties to the global scope + @at-root :root { + @each $var-name, $var-value in $var-map { + @if (type_of($var-value) == string) { + #{$var-name}: $var-value; // to prevent quotes interpolation + } @else { + #{$var-name}: #{$var-value}; } + } + } + } @else { + // Sass or debug + // merge variables and values to the global map (provides no output) + @each $var-name, $var-value in $var-map { + $css-vars: css-var-assign($varName, $varValue) !global; // store in global variable } + } } |