Skip to content

Utilities map configuration functions #35945

@romaricpascal

Description

@romaricpascal

Prerequisites

Proposal

It'd be great if Bootstrap was providing functions or mixins to manipulate that utilities hash a bit more easily. I'm thinking something like:

  • utilities-add-values($utility-name, $values) for adding values to a specific utility
  • utilities-set-values($utility-name, $values) for replacing the values of a utility completely
  • utilities-remove-values($utility-name, $values) for removing targeted values of a utility
  • utilities-set-options($utility-name, $options) to set specific options like responsive
  • utilities-add($new-utility-name, $options) to add a new utility class
  • utilities-remove($utility-name) to completely remove a utility

I'm thinking mixins would provide the best API from a usage point of view, similarly to what sass-mq does for adding breakpoints. allowing to only do:

@include utilities-add-values(...)

instead of having to assign the result of the function each time:

$utilities: utilities-add-values(...)

Motivation and context

The API for manipulating the $utilities map is well documented, but it relies on the low level map-merge. This makes it a bit of a mouthful to write the operations, especially for adding new values to existing utilities.

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