Performance: Preset sharing across projects
MEDIUM IMPACT
This affects the build time and bundle size by reusing shared Tailwind configurations across projects.
/* Create a shared preset package with common Tailwind config */ // shared-preset/index.js module.exports = { theme: { extend: { colors: { brand: '#123456' } } }, plugins: [] }; // In each project tailwind.config.js const sharedPreset = require('shared-preset'); module.exports = { presets: [sharedPreset], theme: { extend: { spacing: { '72': '18rem' } } } };
/* Each project has its own full tailwind.config.js with duplicated settings */ module.exports = { theme: { extend: { colors: { brand: '#123456' } } }, plugins: [] };
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Duplicated Tailwind configs per project | No change | No change | Higher due to larger CSS | [X] Bad |
| Shared Tailwind preset across projects | No change | No change | Lower due to smaller CSS | [OK] Good |