Performance: Custom spacing scale
MEDIUM IMPACT
This affects CSS bundle size and rendering speed by controlling how many custom spacing utilities are generated and used.
module.exports = {
theme: {
extend: {
spacing: {
'1': '0.25rem',
'2': '0.5rem',
'4': '1rem',
'8': '2rem'
}
}
}
}module.exports = {
theme: {
extend: {
spacing: {
'0.5': '0.125rem',
'1': '0.25rem',
'1.5': '0.375rem',
'2': '0.5rem',
'2.5': '0.625rem',
'3': '0.75rem',
'3.5': '0.875rem',
'4': '1rem',
'4.5': '1.125rem',
'5': '1.25rem',
'5.5': '1.375rem',
'6': '1.5rem',
'6.5': '1.625rem',
'7': '1.75rem',
'7.5': '1.875rem',
'8': '2rem',
'8.5': '2.125rem',
'9': '2.25rem',
'9.5': '2.375rem',
'10': '2.5rem'
}
}
}
}| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Large custom spacing scale | No change | No change | Higher due to style recalculation | [X] Bad |
| Minimal custom spacing scale | No change | No change | Lower style recalculation cost | [OK] Good |