Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
98 lines
1.6 KiB
Markdown
98 lines
1.6 KiB
Markdown
---
|
|
name: preset-rem-to-px
|
|
description: Convert rem units to px for utilities
|
|
---
|
|
|
|
# Preset Rem to Px
|
|
|
|
Converts `rem` units to `px` in generated utilities.
|
|
|
|
## Installation
|
|
|
|
```ts
|
|
import { defineConfig, presetRemToPx, presetWind3 } from 'unocss'
|
|
|
|
export default defineConfig({
|
|
presets: [
|
|
presetWind3(),
|
|
presetRemToPx(),
|
|
],
|
|
})
|
|
```
|
|
|
|
## What It Does
|
|
|
|
Transforms all rem values to px:
|
|
|
|
```html
|
|
<div class="p-4">
|
|
```
|
|
|
|
Without preset:
|
|
```css
|
|
.p-4 { padding: 1rem; }
|
|
```
|
|
|
|
With preset:
|
|
```css
|
|
.p-4 { padding: 16px; }
|
|
```
|
|
|
|
## Use Cases
|
|
|
|
- Projects requiring pixel-perfect designs
|
|
- Environments where rem doesn't work well
|
|
- Consistency with pixel-based design systems
|
|
- Email templates (better compatibility)
|
|
|
|
## Options
|
|
|
|
```ts
|
|
presetRemToPx({
|
|
// Base font size for conversion (default: 16)
|
|
baseFontSize: 16,
|
|
})
|
|
```
|
|
|
|
Custom base:
|
|
|
|
```ts
|
|
presetRemToPx({
|
|
baseFontSize: 14, // 1rem = 14px
|
|
})
|
|
```
|
|
|
|
## With Preset Wind4
|
|
|
|
**Note:** `presetRemToPx` is not needed with `preset-wind4`. Use the built-in processor instead:
|
|
|
|
```ts
|
|
import { createRemToPxProcessor } from '@unocss/preset-wind4/utils'
|
|
|
|
export default defineConfig({
|
|
presets: [
|
|
presetWind4({
|
|
preflights: {
|
|
theme: {
|
|
process: createRemToPxProcessor(),
|
|
}
|
|
},
|
|
}),
|
|
],
|
|
// Also apply to utilities
|
|
postprocess: [createRemToPxProcessor()],
|
|
})
|
|
```
|
|
|
|
## Important Notes
|
|
|
|
- Order matters: place after the preset that generates rem values
|
|
- Affects all utilities with rem units
|
|
- Theme values in rem are also converted
|
|
|
|
<!--
|
|
Source references:
|
|
- https://unocss.dev/presets/rem-to-px
|
|
- https://unocss.dev/presets/wind4
|
|
-->
|