I've upgraded my angular app to use the bootstrap 5 styles. Since bootstrap 5 removed many utilities like cursor-pointer, I now have to define the utilities I want to use myself. I've tried to use the api as described in the docs, but without success. The so called utilities I write never end up in the resulting css file.
In the styles.scss I have written the following utility according to the docs:
/* You can add global styles to this file, and also import other style files */
@import "bootstrap/scss/functions";
@import "bootstrap/scss/variables";
@import "bootstrap/scss/utilities";
$utilities: map-merge(
$utilities,
(
"cursor": (
property: cursor,
class: cursor,
// responsive: true,
// values: auto pointer grab
values: (
pointer: pointer,
grab: grab
)
)
)
);
So this should be compiled to style rules like .cursor-pointer { cursor: pointer } and .cursor-grab { cursor: grab }. But when I look in the resulting styles.css, the rules I defined are nowhere to be found.
I've published a repository here.
What am I missing here?
Solution
https://stackblitz.com/edit/angular-ivy-mzexcm?file=src%2Fstyles.scss
bootstrap.scssthroughangular.json, import it fromstyles.scss:angular.json
src/styles.scss
Now you can use both the bootstrap utilities (eg. float-end) and your own utilities (eg. cursor-grab):