check if required scss variables are set

This commit is contained in:
Dan Percic 2022-07-28 19:10:47 +03:00
parent 2065337553
commit 33a7f8e1dc

View File

@ -1,4 +1,5 @@
@use 'sass:meta';
@use 'sass:map';
body {
--iqser-primary: lightblue;
@ -45,10 +46,22 @@ body {
--iqser-button-radius: 17px;
--iqser-button-font-size: 13px;
--iqser-button-height: 34px;
--iqser-font-family: Inter, sans-serif;
--iqser-font-family: "some placeholder value that should be overridden when configuring a theme";
}
$required-variables: "iqser-font-family" "iqser-primary";
@mixin checkRequiredVariables($args, $theme) {
@each $var in $required-variables {
@if map.get(meta.keywords($args), $var) == null {
@error "Missing #{$var} in #{$theme} theme";
}
}
}
@mixin configureLight($args...) {
@include checkRequiredVariables($args, "light");
body.light {
@each $name, $value in meta.keywords($args) {
--#{$name}: #{$value};
@ -57,6 +70,8 @@ body {
}
@mixin configureDark($args...) {
@include checkRequiredVariables($args, "dark");
body.dark {
@each $name, $value in meta.keywords($args) {
--#{$name}: #{$value};