Using CSS variables
// layout-spacing
--s-layout-spacing: 0.4;
--s-layout-spacing-lg: 0.8;
--s-layout-spacing-sm: 0.2;
--s-layout-spacing-unit: 1rem;// Get function.
@use 'node_modules/@angular-package/spectre.css/src/functions/get-var' as *;
// Inject `get-var()` simply by given `$name` parameter and `$unit`.
.layout-spacing {
margin: get-var($name: 'layout-spacing', $unit: 1);
}
// Inject `get-var()` with the smaller spacing without `$name` parameter but
// with -sm added.
.layout-spacing-sm {
margin: get-var('layout-spacing-sm', $unit: 1);
}
// Inject `get-var()` with the larger spacing by using `$suffix` parameter equal
// to `lg`.
.layout-spacing-lg {
margin: get-var('layout-spacing', $unit: 1, $suffix: `lg`);
}Last updated