Skip to content

Conversation

@MartijnCuppens
Copy link
Member

Implementation of responsive font-size system RFS.

Link to feature-request:
#23053

CC: @XhmikosR, @kimamil, @mdo


// Remove px-unit from $fs for calculations.
@if (unit($fs) == 'px') {
$fs: $fs / ($fs * 0 + 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declaration should be terminated by a semicolon

} @else {

// Remove px-unit from $fs for calculations.
@if (unit($fs) == 'px') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings

}

// If $fs is not a number (like inherit) or $fs has a unit (like 1.5em) or $ is 0, just print the value.
@if type-of($fs) != 'number' or (not unitless($fs) and unit($fs) != 'px') or $fs == 0 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings


// Add !important suffix if needed.
@if ($important) {
$rfs-suffix: ' !important';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings

// Responsive font-size mixin.
@mixin rfs($fs, $important: false) {

$rfs-suffix: '';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings


// Remove px-unit from $rfs-breakpoint for calculations.
@if (unit($rfs-breakpoint) == 'px') {
$rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declaration should be terminated by a semicolon

}

// Remove px-unit from $rfs-breakpoint for calculations.
@if (unit($rfs-breakpoint) == 'px') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings


// Remove px-unit from $rfs-minimum-font-size for calculations.
@if (unit($rfs-minimum-font-size) == 'px') {
$rfs-minimum-font-size: $rfs-minimum-font-size / ($rfs-minimum-font-size * 0 + 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declaration should be terminated by a semicolon

$rfs-rem-value: 16 !default;

// Remove px-unit from $rfs-minimum-font-size for calculations.
@if (unit($rfs-minimum-font-size) == 'px') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings

@mabar
Copy link

mabar commented Jul 27, 2017

Poly fluid sizing would be better. More fluent.

@MartijnCuppens
Copy link
Member Author

@mabar, this implementation doesn't require to define mappings for every font-size so it can easily be used by users who do not have much frontend experience.

Copy link

@kimamil kimamil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add an example in the documentation on how to use this with rem? As I understood, rfs must be 'false' and unit set to 'rem'. Then I could use media-breakpoints on the html tag to set the font-size in 'rem'? But basically you suggest using fixed px sizes to set the base font-size in all breakpoints, correct?

Else, nice catch!

MartijnCuppens and others added 2 commits August 1, 2017 19:26
- Explain configuration
- Remove link to github-repo from configuration
- Remove old implementation of bootstrap

## Responsive font sizes
Bootstrap uses <a href="https://github.com/MartijnCuppens/rfs" target="_blank" rel="noopener">RFS</a> to control its font-size. RFS is an SCSS-mixin which automatically calculates the correct font size based on the browsers screen width. You just have got to define your font-size for big screens and the font size will automatically decrease for smaller screens.
Bootstrap uses <a href="https://github.com/MartijnCuppens/rfs" target="_blank" rel="noopener">RFS</a> to control its font size. RFS is an SCSS-mixin which automatically calculates the correct font size based on the browsers screen width. You just have got to define your font size for big screens and the font size will automatically decrease for smaller screens.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to a normal markdown link. Same for other ones too if any.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: aa67653

@MartijnCuppens
Copy link
Member Author

MartijnCuppens commented Aug 1, 2017

This PR contains generated css and had a lot of merge-conflicts since the release of Bootstrap beta, a clean PR is available here: #23734

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants