Problem/Motivation

In bs_base/themes/bs_bootstrap/sass/theme/base/_elements.scss we have very weak try to implement some kind of proper typography. It kind a work for limited amount of elements, plus its totally not scalable or maintainable. We need something much better and ideally we should use some SASS typography framework for this.

Proposed resolution

We have couple of options. https://github.com/Famolus/awesome-sass#typography lists 4 frameworks that we can use. Also zen theme is using https://github.com/jptaranto/typey.

Other resources on this subject

Remaining tasks

  • Check all current SASS frameworks and pick one.
  • Implement chosen framework in bs_bootstrap.

Comments

pivica created an issue. See original summary.

njagojevic’s picture

Assigned: Unassigned » njagojevic
Status: Active » Needs review
StatusFileSize
new26.28 KB

Implemented Typey typography framework. Implemented on common base elements in sass/theme/base/elements. Maybe we should add something more there?

Thoughts?

njagojevic’s picture

StatusFileSize
new724 bytes
new26.28 KB

Fixed some coding standards.

njagojevic’s picture

StatusFileSize
new387 bytes
new26.25 KB

Fixed typo. Don't use patch in #3 comment.

thenchev’s picture

This looks like the implementation in zen. Works on my end.
For a better review we need someone experienced @pivica :)

pivica’s picture

Status: Needs review » Needs work

Okey here is the first review of code. Still didn't install this to check how it actually look, for now this is just a patch code review.

Beside specific points couple of general questions:

  • Why typey is selected on the end - is it better from other frameworks or are they all more or less the same? Any advantages/disadvantages?
  • What ever framework we choose we should add some resource links in documentation and maybe also code variables, sass files in that way that its easy to completely remove or change this framework with some other framework in child theme.
  1. +++ b/themes/bs_bootstrap/css/layout/layout.css
    @@ -42,6 +45,7 @@
    +/*! typey | GPLv2 License | https://github.com/jptaranto/typey */
    
    +++ b/themes/bs_bootstrap/css/theme/print.css
    @@ -1,3 +1,4 @@
    +/*! typey | GPLv2 License | https://github.com/jptaranto/typey */
    
    +++ b/themes/bs_bootstrap/css/theme/theme.css
    @@ -1,67 +1,163 @@
    +/*! typey | GPLv2 License | https://github.com/jptaranto/typey */
    +/*! typey | GPLv2 License | https://github.com/jptaranto/typey */
    

    I don't like seeing this comments in our CSS compiled files. Its fine that they are in sources and sass files but not in compiled files. Can we remove them somehow?

  2. +++ b/themes/bs_bootstrap/css/theme/theme.css
    @@ -1,67 +1,163 @@
    +  background-color: color(text-bg);
    +  color: color(text);
    ...
    +  background-color: color(mark-bg);
    +  color: color(text);
    

    This looks wrong, what are this text-bg, text and mark-bg strings in CSS? Maybe sass is missing $ sign for this vars or something else?

  3. +++ b/themes/bs_bootstrap/sass/theme/base/_elements.scss
    @@ -1,69 +1,225 @@
    +// Root
    

    All this rules in this files came from where, are they recommended start rules for typey or is this our custom rules?

  4. +++ b/themes/bs_bootstrap/sass/theme/base/_elements.scss
    @@ -1,69 +1,225 @@
    +* {
    +  box-sizing: border-box;
    +}
    

    BS _reboot.scss is doing

    html {
      box-sizing: border-box;
    }
    
    *,
    *::before,
    *::after {
      box-sizing: inherit;
    }
    

    Are you sure we need this also?

  5. +++ b/themes/bs_bootstrap/sass/theme/base/_elements.scss
    @@ -1,69 +1,225 @@
    +  -ms-text-size-adjust: 100%;
    +  -webkit-text-size-adjust: 100%;
    

    Is it possible to use unprefixed text-size-adjust and then let autoprefixer to generate prefixed rules?

  6. +++ b/themes/bs_bootstrap/sass/theme/base/_elements.scss
    @@ -1,69 +1,225 @@
    +  // On short pages, we want any background gradients to fill the entire height
    +  // of the browser.
    +  min-height: 100%;
    

    Hmmm not sure about this assumption or at least that this should be in base theme.

    Also how is this related to typography?

  7. +++ b/themes/bs_bootstrap/sass/theme/base/_elements.scss
    @@ -1,69 +1,225 @@
    +  background-color: color(text-bg);
    +  color: color(text);
    

    Yeah here are the missing $ stuff.

  8. +++ b/themes/bs_bootstrap/sass/theme/base/_elements.scss
    @@ -1,69 +1,225 @@
    +  text-decoration: underline;
    +  text-decoration: underline dotted;
    

    Why not just one rule here?

  9. +++ b/themes/bs_bootstrap/sass/theme/base/_elements.scss
    @@ -1,69 +1,225 @@
    +  bottom: -0.25em;
    

    Maybe use some vertical grid generator here or its fine that this is fixed?

  10. +++ b/themes/bs_bootstrap/sass/theme/base/_elements.scss
    @@ -1,69 +1,225 @@
    +%h1 {
    

    This %h1 is for what exactly?

  11. +++ b/themes/bs_bootstrap/sass/variables/_bs_bootstrap.scss
    @@ -5,3 +5,67 @@
    +        xxl:              32px,
    +        xl:               24px,
    +        l:                20px,
    +        m:                $base-font-size,
    ...
    +        bold:             bold,
    +        medium:           500,
    

    I think indentation should be two spaces here.

  12. +++ b/themes/bs_bootstrap/sass/variables/_bs_bootstrap.scss
    @@ -5,3 +5,67 @@
    +        monospace: (
    +                font-family: $menlo,
    +        ),
    

    Two spaces indentation.

njagojevic’s picture

Status: Needs work » Needs review
StatusFileSize
new7.68 KB
new83.08 KB

Generally all mentioned framework are pretty much the same. I found typey more useful as it has some more variables and features for customization compared to others.

Added link to Typey documentation in BS Base readme file and added better description for typey in sass files.

maybe also code variables, sass files in that way that its easy to completely remove or change this framework with some other framework in child theme.

What is the best solution for this?

1. This comments are coming from imported typey library. I couldn't find how to fix this. Do you have any suggestion?

2. I removed this color options as they are already styled with reboot.scss and normalize.scss.

3. Added description for Typey vertical rhythm rules.

4. Removed the first part.

*,
*::before,
*::after {
  box-sizing: inherit;
}

is from reboot.scss.

6. Removed all things that aren't related to typography, as well as this one.

9.

Maybe use some vertical grid generator here or its fine that this is fixed?

Any suggestion here.

10. Changed %h1 to .h1 for all headings.

All other suggestions are applied in this patch.

njagojevic’s picture

StatusFileSize
new577 bytes
new83.07 KB

Fixed forgotten indentation.

pivica’s picture

Status: Needs review » Needs work

Please check latest patch because lots of stuff is removed which are not related to vertical grid support - check some comments bellow - i guess this is an error.

> 1. This comments are coming from imported typey library. I couldn't find how to fix this. Do you have any suggestion?

We can do this easily in gulp process. We don't want to remove all comments but just this boring repeating stuff - something like some plugin (maybe we already have it) that will search&replace and then kill this comments in compiled CSS.

> 9.
>
> Maybe use some vertical grid generator here or its fine that this is fixed?
> Any suggestion here.

No, then i would need to learn how typey works ;) I am just asking can we apply something from typey so this component follows vertical grid?

  1. +++ b/README.md
    @@ -117,3 +117,5 @@ browsersSupport: [
    +- https://github.com/jptaranto/typey
    +  A complete framework for working with typography on the web - applied in BS Bootstrap child theme.
    

    If implementation in bs_bootstrap then the documentation should be also in bs_bootstrap/README.md.

    However it make sense to promote this in bs_base because vertical grid framework is not related to BS. Can we maybe move this to bs_base somehow and then reuse it in bs_bootstrap?

  2. +++ b/themes/bs_bootstrap/bs_bootstrap.libraries.yml
    @@ -11,7 +11,6 @@ global-styling:
    -      css/components/pagination.css: {}
    
    +++ b/themes/starterkit_bootstrap/starterkit_bootstrap.libraries.yml
    @@ -11,7 +11,6 @@ global-styling:
    -      css/components/pagination.css: {}
    

    Why is this removed?

  3. +++ b/themes/bs_bootstrap/bs_bootstrap.libraries.yml
    @@ -91,22 +90,3 @@ util:
    -
    -modal:
    -  css:
    -    component:
    -      css/components/modal.css: {}
    -  js:
    -    js/bootstrap/modal.js: {}
    -  dependencies:
    -    - core/jquery
    -    - bs_bootstrap/util
    -
    -carousel:
    -  css:
    -    component:
    -      css/components/carousel.css: {}
    -  js:
    -    js/bootstrap/carousel.js: {}
    -  dependencies:
    -    - bs_bootstrap/util
    

    Removed why?

  4. +++ b/themes/bs_bootstrap/gulp-options.yml
    @@ -26,5 +26,3 @@ bootstrap:
    -    - 'js/dist/modal.js'
    -    - 'js/dist/carousel.js'
    

    Yeah pretty confused with this removes?

  5. +++ b/themes/bs_bootstrap/sass/variables/_bs_bootstrap.scss
    @@ -5,3 +5,68 @@
    +// Typey variables
    +// Documentation on the [Typey homepage](https://github.com/jptaranto/typey).
    

    This should not be in _bs_bootstrap.scss but in separated sass variable file called _typey.scss for exmaple

  6. +++ /dev/null
    @@ -1,91 +0,0 @@
    -{#
    -/**
    - * @file
    - * Theme override to display a pager.
    

    More strage removes?

pivica’s picture

> What is the best solution for this?

Yeah just decouple stuff in sass so you don't hard bundle typey with other stuff but you keep stuff separated. Then child themes can easily override or remove this stuff in sass compilation. Also keep typey sass vars separated - there is a comment in previous comment about that.

njagojevic’s picture

Status: Needs work » Needs review
StatusFileSize
new29.47 KB
new30.42 KB

This patch has interdiff file with differences between comments #4 and #11. Please don't consider patch in comment #8 as there were wrong removes.

In this patch were applied all suggestions from comment #6 and next suggestions form comment #9 and #10:
- typey implementation moved from BS Bootstrap to BS Base,
- added css strip option to gulp that strips important comments in compiled css,
- typey sass stuff is now decoupled - sass variables in different .scss file,
- for sub and sup elements changed units to rem.

njagojevic’s picture

Assigned: njagojevic » Unassigned
candelas’s picture

Vertical rhythm with Bootstrap 4. Really interesting to get it. Thanks :)

pivica’s picture

Issue summary: View changes
pivica’s picture

Nice article discussing vertical rhythm implementation https://www.lullabot.com/articles/designing-rhythm-and-proportion.

pivica’s picture

Status: Needs review » Active
pivica’s picture

Just figure it out that latest Bootstrap is using new rfs library for responsive fonts https://github.com/twbs/rfs. We should switch using this.

pivica’s picture

Version: 8.x-1.x-dev » 2.x-dev