Challenge - 5 Problems
Tailwind Purge Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
What is the main purpose of purging unused styles in Tailwind CSS?
Why do developers use purging in Tailwind CSS projects?
Attempts:
2 left
💡 Hint
Think about how purging affects the size and performance of your website.
✗ Incorrect
Purging removes unused CSS classes from the final build, making the CSS file smaller and faster to load.
📝 Syntax
intermediate2:00remaining
Which Tailwind config snippet correctly enables purging for HTML and JS files?
Select the correct
content array in tailwind.config.js to purge unused styles from HTML and JavaScript files.Tailwind
module.exports = {
content: [
// Your answer here
],
theme: {
extend: {},
},
plugins: [],
}Attempts:
2 left
💡 Hint
You want to scan files that contain Tailwind class names, usually HTML and JS files.
✗ Incorrect
The content array should include paths to files where Tailwind classes are used, like HTML and JS files.
❓ rendering
advanced1:30remaining
What will be the size difference after purging unused styles in this Tailwind project?
Given a project with 1000 Tailwind utility classes in source files but only 100 are used in HTML, what happens to the CSS file size after purging?
Attempts:
2 left
💡 Hint
Purging removes unused classes, so the size depends on how many classes remain.
✗ Incorrect
Only the classes used in source files remain, so the CSS file shrinks to about 10% if 100 of 1000 classes are used.
❓ selector
advanced2:00remaining
Which Tailwind CSS class will NOT be removed by purge if used dynamically in JavaScript?
You have this JavaScript code:
const btnClass = `bg-${color}-500`; where color can be 'red' or 'blue'. Which class must be added to tailwind.config.js safelist to avoid purging?Attempts:
2 left
💡 Hint
Purge cannot detect dynamic class names unless explicitly safelisted.
✗ Incorrect
Dynamic classes like bg-red-500 and bg-blue-500 must be safelisted to prevent purging.
❓ accessibility
expert2:30remaining
How does purging unused styles affect accessibility in Tailwind projects?
Consider a Tailwind project where purging removes unused utility classes. What is a potential accessibility risk if purging is misconfigured?
Attempts:
2 left
💡 Hint
Think about what happens if classes controlling focus or visibility are removed.
✗ Incorrect
If focus or visibility classes are removed by mistake, keyboard users or screen readers may lose important cues, harming accessibility.