Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !29152

Add possibility to use RFS in utility API

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge master-mc-rfs into master 6 years ago
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 4

Created by: MartijnCuppens

RFS v9 has launched and with the new version it will be possible to apply the same rescaling technique to any property.

Features:

  • Responsive font sizes are now enabled by default
  • Utility API integration
    • Fluid rescaling is also applied to the spacing utilities (option can be disabled)
    • New .font-size-sm, .font-size-base, .font-size-lg and .font-size-xl utilities
    • New .text-sm, .text-base, .text-lg and .text-xl utilities
  • Documentation page with basic how-to-use examples.

Docs: https://deploy-preview-29152--twbs-bootstrap.netlify.com/docs/4.3/getting-started/rfs/ Responsive displays: https://deploy-preview-29152--twbs-bootstrap.netlify.com/docs/4.3/content/typography/#display-headings

Closes #25832 (closed)

Compare
  • master (base)

and
  • latest version
    563be155
    1 commit, 2 years ago

4 files
+ 41
- 5

    Preferences

    File browser
    Compare changes
sc‎ss‎
mix‎ins‎
_utilit‎ies.scss‎ +20 -5
util‎ities‎
_api‎.scss‎ +18 -0
bootstrap‎-grid.scss‎ +2 -0
site/content/do‎cs/4.3/utilities‎
api‎.md‎ +1 -0
scss/mixins/_utilities.scss
+ 20
- 5
  • View file @ 563be155


// Utility generator
// Used to generate utilities & print utilities
@mixin generate-utility($utility, $infix) {
@mixin generate-utility($utility, $infix, $is-rfs-media-query: false) {
$values: map-get($utility, values);
// If the values are a list or string, convert it into a map
@@ -25,10 +25,25 @@
// Don't prefix if value key is null (eg. with shadow class)
$property-class-modifier: if($key, if($property-class == "" and $infix == "", "", "-") + $key, "");
.#{$property-class + $infix + $property-class-modifier} {
@each $property in $properties {
// stylelint-disable-next-line declaration-no-important
#{$property}: $value !important;
@if map-get($utility, rfs) {
// Inside the media query
@if $is-rfs-media-query {
$val: rfs-value($value);
// Do not render anything if fluid and non fluid values are the same
$value: if($val == rfs-fluid-value($value), null, $val);
}
@else {
$value: rfs-fluid-value($value);
}
}
@if $value != null {
.#{$property-class + $infix + $property-class-modifier} {
@each $property in $properties {
// stylelint-disable-next-line declaration-no-important
#{$property}: $value !important;
}
}
}
}
scss/utilities/_api.scss
+ 18
- 0
  • View file @ 563be155


@@ -16,6 +16,24 @@
}
}
// RFS rescaling
@media (min-width: $rfs-mq-value) {
@each $breakpoint in map-keys($grid-breakpoints) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
@if (map-get($grid-breakpoints, $breakpoint) < $rfs-breakpoint) {
// Loop over each utility property
@each $key, $utility in $utilities {
// The utility can be disabled with `false`, thus check if the utility is a map first
// Only proceed if responsive media queries are enabled or if it's the base media query
@if type-of($utility) == "map" and map-get($utility, rfs) {
@include generate-utility($utility, $infix, true);
}
}
}
}
}
// Print utilities
@media print {
scss/bootstrap-grid.scss
+ 2
- 0
  • View file @ 563be155


@@ -23,6 +23,8 @@ html {
@import "mixins/grid";
@import "mixins/utilities";
@import "vendor/rfs";
@import "grid";
@import "utilities";
site/content/docs/4.3/utilities/api.md
+ 1
- 0
  • View file @ 563be155


@@ -13,6 +13,7 @@ The `$utilities` map contains all utilities and is later merged with your custom
- `property`: Name of the property, this can be a string or an array of strings (needed for eg. horizontal paddings or margins).
- `responsive` _(optional)_: Boolean indicating if responsive classes need to be generated. `false` by default.
- `rfs` _(optional)_: Variable to enable fluid rescaling. Have a look at the [RFS]({{< docsref "/getting-started/rfs" >}}) page to find out how this works. `false` by default.
- `class` _(optional)_: Variable to change the class name if you don't want it to be the same as the property. In case you don't provide the `class` key and `property` key is an array of strings, the class name will be the first element of the `property` array.
- `values`: This can be a list of values or a map if you don't want the class name to be the same as the value. If null is used as map key, it isn't rendered.
- `print` _(optional)_: Boolean indicating if print classes need to be generated. `false` by default.
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
3
css no-backport-to-v4 v5
3
css no-backport-to-v4 v5
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
2
2 participants
Administrator
Ghost User
Reference: twbs/bootstrap!29152
Source branch: master-mc-rfs

Menu

Explore Projects Groups Snippets