mirror of https://github.com/twbs/bootstrap.git
Use `@forward` instead of `@use` for proper customization (#41762)
* Use `@forward` instead of `@use` for proper customization * linty linterson * woof
This commit is contained in:
parent
956de4bbaf
commit
f0c163b917
|
@ -6,11 +6,11 @@
|
|||
// @forward "variables";
|
||||
|
||||
// Layout & components
|
||||
@use "root" as *;
|
||||
@forward "root";
|
||||
|
||||
// Helpers
|
||||
@forward "helpers";
|
||||
|
||||
// Utilities
|
||||
@use "utilities" as *;
|
||||
@use "utilities/api";
|
||||
@forward "utilities";
|
||||
@forward "utilities/api";
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
@use "banner";
|
||||
@forward "banner";
|
||||
|
||||
// scss-docs-start import-stack
|
||||
// Global CSS variables, layer definitions, and configuration
|
||||
@use "root";
|
||||
@forward "root";
|
||||
|
||||
// Subdir imports
|
||||
@use "content";
|
||||
@use "layout";
|
||||
@use "forms";
|
||||
@use "buttons";
|
||||
@forward "content";
|
||||
@forward "layout";
|
||||
@forward "forms";
|
||||
@forward "buttons";
|
||||
|
||||
// Components
|
||||
@use "accordion";
|
||||
@use "alert";
|
||||
@use "badge";
|
||||
@use "breadcrumb";
|
||||
@use "card";
|
||||
@use "carousel";
|
||||
@use "dropdown";
|
||||
@use "list-group";
|
||||
@use "modal";
|
||||
@use "nav";
|
||||
@use "navbar";
|
||||
@use "offcanvas";
|
||||
@use "pagination";
|
||||
@use "placeholders";
|
||||
@use "popover";
|
||||
@use "progress";
|
||||
@use "spinners";
|
||||
@use "toasts";
|
||||
@use "tooltip";
|
||||
@use "transitions";
|
||||
@forward "accordion";
|
||||
@forward "alert";
|
||||
@forward "badge";
|
||||
@forward "breadcrumb";
|
||||
@forward "card";
|
||||
@forward "carousel";
|
||||
@forward "dropdown";
|
||||
@forward "list-group";
|
||||
@forward "modal";
|
||||
@forward "nav";
|
||||
@forward "navbar";
|
||||
@forward "offcanvas";
|
||||
@forward "pagination";
|
||||
@forward "placeholders";
|
||||
@forward "popover";
|
||||
@forward "progress";
|
||||
@forward "spinners";
|
||||
@forward "toasts";
|
||||
@forward "tooltip";
|
||||
@forward "transitions";
|
||||
|
||||
// Helpers
|
||||
@use "helpers";
|
||||
@forward "helpers";
|
||||
|
||||
// Utilities
|
||||
@use "utilities/api";
|
||||
@forward "utilities/api";
|
||||
// scss-docs-end import-stack
|
||||
|
|
|
@ -8,7 +8,7 @@ module.exports = {
|
|||
spec_dir: 'scss',
|
||||
// Make Jasmine look for `.test.scss` files
|
||||
// spec_files: ['**/*.{test,spec}.scss'],
|
||||
spec_files: ['**/_utilities.test.scss'],
|
||||
spec_files: ['**/_utilities.test.scss', '**/modules/_configuration.test.scss'],
|
||||
// Compile them into JS scripts running `sass-true`
|
||||
requires: [path.join(__dirname, 'sass-true/register')],
|
||||
// Ensure we use `require` so that the require.extensions works
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
// Test @use with configuration syntax using a single module instance
|
||||
@use "../../alert" as * with (
|
||||
$alert-margin-bottom: 3rem,
|
||||
$alert-link-font-weight: 800
|
||||
);
|
||||
@use "../../variables" as *;
|
||||
|
||||
$true-terminal-output: false;
|
||||
|
||||
@include describe("Bootstrap module configuration") {
|
||||
@include describe("@use with configuration syntax") {
|
||||
@include it("should allow configuring alert variables with @use ... with") {
|
||||
@include assert() {
|
||||
@include output() {
|
||||
.test {
|
||||
margin-bottom: $alert-margin-bottom;
|
||||
font-weight: $alert-link-font-weight;
|
||||
}
|
||||
}
|
||||
|
||||
@include expect() {
|
||||
.test {
|
||||
margin-bottom: 3rem;
|
||||
font-weight: 800;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@include it("should maintain other alert variables with default values") {
|
||||
@include assert() {
|
||||
@include output() {
|
||||
.test {
|
||||
padding-y: $alert-padding-y;
|
||||
padding-x: $alert-padding-x;
|
||||
// stylelint-disable-next-line property-disallowed-list
|
||||
border-radius: $alert-border-radius;
|
||||
}
|
||||
}
|
||||
|
||||
@include expect() {
|
||||
.test {
|
||||
padding-y: 1rem;
|
||||
padding-x: 1rem;
|
||||
// stylelint-disable-next-line property-disallowed-list
|
||||
border-radius: var(--bs-border-radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue