npm install dialog-settings


A simple key value store for module settings, to make modules more portable.
With the nice side-effect that all settings can be rendered as native CSS variables. Play with the demo.
scss
$module-name: 'mymodule';$mymodule-background: $colors-dark;
$mymodule-color: $colors-contrast;
$mymodule-margin: 2rem;
.#{$module-name} {
color: $mymodule-color;
background: $mymodule-background;
margin: $mymodule-margin;
}
`
$3
`scss
$module-name: 'mymodule';@include settings((
color: $colors-dark,
background: $colors-contrast,
margin: 2rem
));
.#{$module-name} {
color: setting(color);
background: setting(background);
margin: setting(margin);
}
`
Installation 💾
`
npm install dialog-settings
`Basic usage ☝️
1. Import
dialog-settings.scss
`scss
@import 'dialog-settings/dist/dialog-settings';
`
PS: make sure to add node_modules to your import paths2. Setup your module by setting a name-space and calling the setting mixin
`scss
$module-name: 'somerandommodule'; @include settings((
gutter : 1rem,
color : silver,
color-contrast : gold
));
`3. Call the
setting() function.
`scss
.#{$module-name} {
padding: setting('gutter');
&__submodule {
color: setting(color);
}
}
`4. By setting the global variable
$module-cssvariables the variable are rendered as CSS` variables.Created with ♥ by meodai. Licensed under the MIT License.