A Tailwind CSS preset is a reusable configuration file that contains shared design tokens, plugins, and settings. It helps keep styles consistent across multiple projects by sharing the same base setup.
Click to reveal answer
intermediate
How do you share a Tailwind preset across projects?
You create a separate npm package with your Tailwind preset configuration. Then, install that package in each project and reference it in the tailwind.config.js file under the presets array.
Click to reveal answer
beginner
Why use Tailwind presets instead of copying config files?
Presets allow you to update shared styles in one place. All projects using the preset get the update automatically, avoiding mistakes and saving time compared to copying config files manually.
Click to reveal answer
beginner
What is the key field in tailwind.config.js to add a preset?
The key field is <code>presets</code>. It is an array where you import and add your preset package to extend your Tailwind configuration.
Click to reveal answer
intermediate
Can Tailwind presets include plugins and custom utilities?
Yes! Presets can include plugins, custom utilities, theme extensions, and variants. This makes them powerful for sharing complex design systems across projects.
Click to reveal answer
What is the main benefit of using Tailwind presets across projects?
ATo share and update design settings easily in multiple projects
BTo reduce the size of CSS files
CTo avoid using npm packages
DTo disable Tailwind plugins
✗ Incorrect
Tailwind presets help share and update design settings easily across projects by centralizing configuration.
Where do you add a Tailwind preset in your project?
AIn the CSS file directly
BIn the <code>presets</code> array inside tailwind.config.js
CIn the package.json file
DIn the <code>plugins</code> array inside tailwind.config.js
✗ Incorrect
Presets are added in the presets array inside the tailwind.config.js file.
How do you distribute a Tailwind preset to other projects?
AEmbed it in HTML files
BCopy the config file manually
CUse a CDN link
DPublish it as an npm package
✗ Incorrect
Publishing the preset as an npm package allows easy installation and updates across projects.
Can Tailwind presets include custom colors and fonts?
AYes, presets can extend themes with custom colors and fonts
BNo, presets only include plugins
CNo, presets cannot change themes
DOnly fonts, not colors
✗ Incorrect
Presets can extend the theme with custom colors, fonts, and other design tokens.
What happens when you update a Tailwind preset package?
AOnly new projects get the update
BProjects must copy the config again manually
CAll projects using it get the updated styles after reinstalling
DThe preset stops working
✗ Incorrect
Updating the preset package and reinstalling it in projects applies the new styles everywhere.
Explain how to create and use a Tailwind preset to share styles across multiple projects.
Think about packaging config and referencing it in projects.
You got /5 concepts.
Describe the benefits of using Tailwind presets instead of copying config files between projects.
Focus on maintenance and consistency advantages.
You got /5 concepts.
Practice
(1/5)
1. What is the main purpose of using presets in Tailwind CSS configuration?
easy
A. To create custom CSS animations
B. To share common Tailwind settings across multiple projects
C. To add new color palettes only for one project
D. To compile Tailwind CSS faster on a single project
Solution
Step 1: Understand the role of presets
Presets are used to share configuration settings like colors, fonts, and plugins across projects.
Step 2: Compare options
Options B, C, and D describe features unrelated to sharing configs across projects.
Final Answer:
To share common Tailwind settings across multiple projects -> Option B
Quick Check:
Presets = Shared config across projects [OK]
Hint: Presets = shared config for multiple projects [OK]
Common Mistakes:
Thinking presets only add colors or animations
Confusing presets with plugins
Believing presets speed up compilation
2. Which of the following is the correct way to include a preset in tailwind.config.js?
easy
A. presets: require('tailwind-preset')
B. presets: ['tailwind-preset']
C. presets: [require('tailwind-preset')]
D. preset: [require('tailwind-preset')]
Solution
Step 1: Check the correct property name and syntax
The property is presets (plural) and it expects an array of required modules.
Step 2: Validate each option
presets: [require('tailwind-preset')] uses presets with an array containing require('tailwind-preset'), which is correct syntax.
Local config overrides preset values when keys conflict, so local primary color '#ff0000' overrides preset '#00ff00'.
Step 2: Determine final color for bg-primary
The div uses the local config color '#ff0000' (red).
Final Answer:
#ff0000 (red) from local config -> Option A
Quick Check:
Local config overrides preset colors [OK]
Hint: Local theme colors override preset colors [OK]
Common Mistakes:
Assuming preset colors override local config
Thinking conflicting keys cause errors
Believing class won't apply without explicit import
4. You added a preset in tailwind.config.js but your styles from the preset are not applying. What is the most likely mistake?
medium
A. Using preset instead of presets in config
B. Forgetting to export the preset module with module.exports
C. Not installing Tailwind CSS in the project
D. Adding presets inside the theme object
Solution
Step 1: Check common config mistakes
Using preset (singular) instead of presets (plural) means Tailwind ignores the preset array.
Step 2: Validate other options
Forgetting to export the preset module with module.exports is possible but less common; C and D are unrelated to preset loading.
Final Answer:
Using preset instead of presets in config -> Option A
Quick Check:
Correct property name is 'presets' [OK]
Hint: Use 'presets' plural, not 'preset' singular [OK]
Common Mistakes:
Misspelling 'presets' as 'preset'
Placing presets inside wrong config section
Not exporting preset module properly
5. You want to share a preset that includes custom fonts and colors across three projects. Which approach ensures all projects use the preset and can override colors if needed?
hard
A. Use Tailwind's CDN link with custom fonts and colors embedded
B. Copy the preset config file into each project and import it manually in CSS files
C. Write the preset config directly inside each project's tailwind.config.js without sharing
D. Create a separate npm package with the preset and add it in each project's presets array; override colors locally as needed
Solution
Step 1: Identify best sharing method
Creating a separate npm package for the preset allows easy reuse and updates across projects.
Step 2: Confirm override capability
Adding the preset in presets array lets each project override colors locally without changing the shared preset.
Final Answer:
Create a separate npm package with the preset and add it in each project's presets array; override colors locally as needed -> Option D
Quick Check:
npm package + presets array + local overrides = best practice [OK]
Hint: Use npm package for preset + local overrides [OK]
Common Mistakes:
Copying preset files manually causing duplication
Embedding config directly without sharing
Using CDN which can't share config presets
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.