Rem
@unsass/rem provides a consistent way to express CSS lengths in rem, converting from pixels against a single, configurable baseline.
Unlike em, rem always resolves against the document root, so conversions need no per-call context — just one baseline for the whole project.
Repository: github.com/unsass/rem
Install
sh
npm install @unsass/remsh
yarn add @unsass/remsh
pnpm add @unsass/remBasic usage
scss
@use "@unsass/rem";
.foo {
font-size: rem.convert(16px);
}css
.foo {
font-size: 1rem;
}Next steps
- Configuration — set the baseline.
- Functions and Mixins — the full API.
- Best Practices — what to convert and what to leave alone.