0
0
Tailwindmarkup~20 mins

Purging unused styles in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Tailwind Purge Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the main purpose of purging unused styles in Tailwind CSS?
Why do developers use purging in Tailwind CSS projects?
ATo convert CSS classes into inline styles in HTML
BTo add more utility classes automatically during build
CTo remove unused CSS classes and reduce the final CSS file size
DTo disable responsive design features in Tailwind
Attempts:
2 left
💡 Hint
Think about how purging affects the size and performance of your website.
📝 Syntax
intermediate
2: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: [],
}
A["./src/**/*.{html,js}"]
B["./src/**/*.css"]
C["./src/**/*.{html,css}"]
D["./src/**/*.{js,json}"]
Attempts:
2 left
💡 Hint
You want to scan files that contain Tailwind class names, usually HTML and JS files.
rendering
advanced
1: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?
AThe CSS file size will be roughly 10% of the original size
BThe CSS file size will remain the same
CThe CSS file size will increase due to added purge comments
DThe CSS file size will be zero because all classes are removed
Attempts:
2 left
💡 Hint
Purging removes unused classes, so the size depends on how many classes remain.
selector
advanced
2: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?
Abg-red and bg-blue
Bbg-${color}-500
Cbg-500-red and bg-500-blue
Dbg-red-500 and bg-blue-500
Attempts:
2 left
💡 Hint
Purge cannot detect dynamic class names unless explicitly safelisted.
accessibility
expert
2: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?
APurging automatically adds ARIA attributes to elements
BImportant focus or visibility classes might be removed, breaking keyboard navigation or screen reader support
CPurging disables color contrast checks in browsers
DPurging converts all text to uppercase, harming readability
Attempts:
2 left
💡 Hint
Think about what happens if classes controlling focus or visibility are removed.