What is this?
typography-desktop is a package that exports font grouping CSS classes, such as
.xlarge-bold, for consumer web projects to consume.
These classes are generated dynamically based on the latest version of
otkit-typography-desktop design token.
Why are you doing this?
The way different consumer web teams apply typography styling to their front end components is very fragmented. We have lots of duplications, overrides and human errors.
We try to solve this problem by enforcing consistency via encapsulating the entire design decision inside CSS classes.
I choose CSS class as the transport mechanism because of its simplicity, familiarity and flexibility.
How is this package set up?
Let's briefly explain the decision flow when it comes to typography. Let's use
.xlarge-bold as example.
- Designers decided
xlarge-boldshould be one of the desktop web typography groupings inside their design system.
- Design tokens deconstructs
xlarge-boldinto atomic elements, such as
xlarge-bold-line-height, and stores them inside
- We import these values from design tokens, reconstructing the composited
.xlarge-bold, which serves as a 1:1 model / engineering translation of the design decision.
- You, as a developer of a consumer web project, can then use it.
How do I use it / how does it help me?
Let's expand bullet point number 4 from above.
TL;DR: No more repeating the same CSS declarations - font sizes, font weights, line heights, even class compositions - over and over again!
To use it, simply install:
npm i --save-dev @ot-react-ui/typography-desktop
Then depends on your choice of CSS technologies, there are many ways to consume this package:
Sass / Scss
If your project uses vanilla CSS you can simply import it in your bundle then use the class names directly.
This package requires node 8. Other node versions may throw errors when you run scripts.
This package requires npm 5, if you'd like to publish. We are using features that's only available after npm 4.
Before you publish, please make sure your
.npmrc is pointing to the OpenTable private registry with correct credentials.
Please also make sure you have already installed all dependencies for this package and have the correct node / npm versions.
This package should only be published by running:
npm run update-publish