@capsizecss/core
4.1.3 · 12 Nov 2025MIT205.9k / weekRepositoryHomepagenpmAtom feed
3.1.1 is the newest release of 3.x.
In short
2 new
Release note
Minor Changes
Add
createFontStackfor metrics-based font family fallbacks.Creates metrics-based
@font-facedeclarations to improve the alignment of font family fallbacks, which can dramatically improve the Cumulative Layout Shift metric for sites that depend on a web font.
Example usage
```ts
import { createFontStack } from '@capsizecss/core';
import lobster from '@capsizecss/metrics/lobster';
import helveticaNeue from '@capsizecss/metrics/helveticaNeue';
import arial from '@capsizecss/metrics/arial';
const { fontFamily, fontFaces } = createFontStack([
lobster,
helveticaNeue,
arial,
]);
```
The returned values are the computed font family and the generated font face declarations:
```ts
// `fontFamily`
"Lobster, 'Lobster Fallback: Helvetica Neue', 'Lobster Fallback: Arial'";
```
```css
/* `fontFaces` */
@font-face {
font-family: 'Lobster Fallback: Helvetica Neue';
src: local('Helvetica Neue');
ascent-override: 115.1741%;
descent-override: 28.7935%;
size-adjust: 86.8251%;
}
@font-face {
font-family: 'Lobster Fallback: Arial';
src: local('Arial');
ascent-override: 113.5679%;
descent-override: 28.392%;
size-adjust: 88.053%;
}
```Patch Changes
Add additional properties to
FontMetricstype definition.Previously the
FontMetricstype captured only the metrics required by the options for thecreateStyleObjectandcreateStyleStringAPIs.
With additional APIs coming that require a different subset of metrics, the type now reflects the structure of the data from themetricspackage.The additional properties are:
familyName,category,xHeightandxWidthAvg.
See documentation for more details.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.