]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
docs: add info on modifying and adding utilities
authorLuke-zhang-04 <luke.zhang2004dev@gmail.com>
Sun, 19 Jul 2020 18:08:41 +0000 (21:08 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Thu, 5 Nov 2020 05:50:09 +0000 (07:50 +0200)
site/content/docs/5.0/utilities/api.md

index 7dd0d6ede53349808e23f098fa35352ca2822b6b..aee021b4fb230b85016e1612ab7bb6e24aab4951 100644 (file)
@@ -212,3 +212,45 @@ $utilities: (
   "float": null,
 );
 ```
+
+## Adding to existing utilities
+
+Add new utilities with `map-merge`.Start by importing the utilities stylesheet, then use `map-merge` to add new properties and values.s
+
+```scss
+@import "bootstrap/scss/utilities";
+
+$utilities: map-merge(
+  $utilities,
+  (
+    "font-size": (
+      responsive: true,
+      property: font-weight,
+      values: $display-font-sizes,
+    )
+  )
+);
+```
+
+## Modifying existing utilities
+
+Modify existing utilities with `map-get` and `map-merge`. Once again, be sure to import the utilities stylesheet before your custom utilities.
+
+```scss
+@import "bootstrap/scss/utilities";
+
+$utilities: map-merge(
+  $utilities,
+  (
+    "width": map-merge(
+      map-get($utilities, "width"),
+      (
+        values: map-merge(
+          map-get(map-get($utilities, "width"), "values"),
+          (10: 10%),
+        ),
+      ),
+    ),
+  )
+);
+```