0
0
Tailwindmarkup~10 mins

Preset sharing across projects in Tailwind - Browser Rendering Trace

Choose your learning style9 modes available
Render Flow - Preset sharing across projects
[Create base Tailwind config] -> [Extract shared preset config] -> [Publish preset as package or local file] -> [Import preset in project configs] -> [Merge preset with project styles] -> [Build CSS with shared styles]
The browser loads Tailwind CSS built from configs that import shared presets. Presets provide common styles reused across projects, merged during build to produce final CSS.
Render Steps - 3 Steps
Code Added:Create base Tailwind config without preset
Before
[text-primary]
  No special color applied
  Text looks default black
After
[text-primary]
  Still default black text
  No shared styles applied
Without the preset, the 'text-primary' class has no special styles and looks like normal text.
🔧 Browser Action:No CSS rules generated for 'text-primary', browser renders default styles
Code Sample
An element styled with a shared preset color 'primary' from a preset config used in multiple projects.
Tailwind
<div class="text-primary">Click me</div>
Tailwind
/* tailwind.config.js in project A */
module.exports = {
  presets: [require('./tailwind-preset')],
  content: ['./src1*.{html,js}'],
};

/* tailwind-preset.js shared */
module.exports = {
  theme: {
    extend: {
      colors: {
        primary: '#1D4ED8'
      }
    }
  },
  plugins: []
};
Render Quiz - 3 Questions
Test your understanding
After applying step 2, what visual change happens to the 'text-primary' text?
AText color changes to blue (#1D4ED8)
BText becomes bold
CBackground color changes to blue
DNo visual change
Common Confusions - 2 Topics
Why doesn't my shared preset color apply in the project?
The preset must be correctly imported in the project's tailwind.config.js under 'presets'. Also, the build process must run after adding the preset to generate updated CSS.
💡 If text looks default black, check if preset is imported and build ran (see render_steps 2 and 3).
Can I override preset colors in my project config?
Yes, project config theme settings override preset values if defined after the preset import, allowing customization per project.
💡 Later theme.extend colors replace preset colors visually (not shown in steps but important).
Property Reference
PropertyValue AppliedEffectCommon Use
presetsArray of config objects or modulesMerges shared styles and settings into project configReuse common theme/colors/plugins across projects
theme.extend.colors.primary'#1D4ED8'Defines a shared primary color used in classesConsistent branding color
contentArray of file globsDefines files Tailwind scans for class namesEnsures CSS includes only used styles
Concept Snapshot
Tailwind presets let you share common config across projects. Use 'presets' array in tailwind.config.js to import shared styles. Presets merge theme colors, plugins, and variants. Build process merges preset styles into final CSS. Overrides in project config take priority over presets. Ensures consistent design and easier maintenance.