Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marketing: optimize body typography inheritance #1382

Merged
merged 4 commits into from
May 6, 2021

Conversation

tobiasahlin
Copy link
Contributor

@tobiasahlin tobiasahlin commented May 5, 2021

This PR introduces no visual changes, but optimizes the CSS output for marketing's typography body utility classes. By making sure that no values are being set if it's not necessary to set them, we avoid outputting some redundant CSS properties.

The logic behind this can definitely be refined further, but this brings the logic and setup behind the header and the body utility classes to parity. Would love to clean up the logic in another PR 🙏

CSS output, before (76 rows):

.f0-mktg {
  font-size: 28px !important;
  line-height: 40px !important;
  letter-spacing: -.01em !important;
  font-weight: 500 !important
}
@media (min-width: 768px) {
  .f0-mktg {
    font-size: 40px !important;
    line-height: 52px !important;
    letter-spacing: -.01em !important;
    font-weight: 500 !important
  }
}
@media (min-width: 1012px) {
  .f0-mktg {
    font-size: 48px !important;
    line-height: 64px !important;
    letter-spacing: -.01em !important;
    font-weight: 500 !important
  }
}
.f1-mktg {
  font-size: 24px !important;
  line-height: 32px !important;
  font-weight: 500 !important
}
@media (min-width: 768px) {
  .f1-mktg {
    font-size: 28px !important;
    line-height: 40px !important;
    letter-spacing: -.01em !important;
    font-weight: 500 !important
  }
}
@media (min-width: 1012px) {
  .f1-mktg {
    font-size: 32px !important;
    line-height: 44px !important;
    letter-spacing: -.01em !important;
    font-weight: 500 !important
  }
}
.f2-mktg {
  font-size: 20px !important;
  line-height: 28px !important
}
@media (min-width: 1012px) {
  .f2-mktg {
    font-size: 24px !important;
    line-height: 32px !important;
    font-weight: 500 !important
  }
}
.f3-mktg {
  font-size: 16px !important;
  line-height: 24px !important
}
@media (min-width: 768px) {
  .f3-mktg {
    font-size: 20px !important;
    line-height: 28px !important
  }
}
.f4-mktg {
  font-size: 16px !important;
  line-height: 24px !important
}
.f5-mktg {
  font-size: 14px !important;
  line-height: 20px !important
}
.f6-mktg {
  font-size: 12px !important;
  line-height: 20px !important
}

CSS output, after (69 rows):

.f0-mktg {
  font-size: 28px !important;
  line-height: 40px !important;
  letter-spacing: -.01em !important;
  font-weight: 500 !important
}
@media (min-width: 768px) {
  .f0-mktg {
    font-size: 40px !important;
    line-height: 52px !important
  }
}
@media (min-width: 1012px) {
  .f0-mktg {
    font-size: 48px !important;
    line-height: 64px !important
  }
}
.f1-mktg {
  font-size: 24px !important;
  line-height: 32px !important;
  font-weight: 500 !important
}
@media (min-width: 768px) {
  .f1-mktg {
    font-size: 28px !important;
    line-height: 40px !important;
    letter-spacing: -.01em !important
  }
}
@media (min-width: 1012px) {
  .f1-mktg {
    font-size: 32px !important;
    line-height: 44px !important
  }
}
.f2-mktg {
  font-size: 20px !important;
  line-height: 28px !important
}
@media (min-width: 1012px) {
  .f2-mktg {
    font-size: 24px !important;
    line-height: 32px !important;
    font-weight: 500 !important
  }
}
.f3-mktg {
  font-size: 16px !important;
  line-height: 24px !important
}
@media (min-width: 768px) {
  .f3-mktg {
    font-size: 20px !important;
    line-height: 28px !important
  }
}
.f4-mktg {
  font-size: 16px !important;
  line-height: 24px !important
}
.f5-mktg {
  font-size: 14px !important;
  line-height: 20px !important
}
.f6-mktg {
  font-size: 12px !important;
  line-height: 20px !important
}

@changeset-bot
Copy link

changeset-bot bot commented May 5, 2021

🦋 Changeset detected

Latest commit: e092c25

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/css Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@simurai simurai merged commit 7dce045 into main May 6, 2021
@simurai simurai deleted the tobiasahlin/optimize-marketing-body-inheritence branch May 6, 2021 08:41
@primer-css primer-css mentioned this pull request May 6, 2021
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.

3 participants