Skip to content

More clearly how to remove from map #25573

@ysds

Description

@ysds

I think that a way to remove a key/value from Sass maps is not clear.

The theming page documents:

To remove colors from $theme-colors, or any other map, use map-remove:

$theme-colors: map-remove($theme-colors, "success", "info", "danger");

But, it is not clear where to insert it.

For example, the following SCSS to modify or add key/value works well:

$theme-colors: (
  "primary": #0074d9,
  "danger": #ff4136
);

@import "node_modules/bootstrap/scss/bootstrap";

But it does not work when write SCSS to remove key/value on the same place:

$theme-colors: map-remove($theme-colors, "success", "info", "danger");

@import "node_modules/bootstrap/scss/bootstrap";

To remove colors from $theme-colors, or any other map, map-remove should be written between the requires and the options:

// Required
@import "node_modules/bootstrap/scss/functions";
@import "node_modules/bootstrap/scss/variables";
@import "node_modules/bootstrap/scss/mixins";

$theme-colors: map-remove($theme-colors, "success", "info", "danger");

// Optional
@import "node_modules/bootstrap/scss/reboot";
...

It would be more helpful if documented about this.

I have no time to create a demo about this issue, but I hope bootstrap team can easily confirm this by adjust the bootstrap.scss. thank you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions