0
0
Tailwindmarkup~20 mins

Content configuration for tree-shaking in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Tailwind Tree-Shaking Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why is content configuration important for Tailwind CSS tree-shaking?

Tailwind CSS removes unused styles during build to reduce file size. Why must you configure the content option correctly?

ATo specify the colors Tailwind should use in the project.
BTo tell Tailwind which files to scan for class names so it keeps only used styles.
CTo define the font sizes Tailwind will generate in the CSS.
DTo set the screen sizes for responsive design.
Attempts:
2 left
💡 Hint

Think about how Tailwind knows which CSS classes you actually use in your files.

📝 Syntax
intermediate
2:00remaining
Which content configuration correctly includes all HTML and JS files in the src folder?

Choose the correct content array for Tailwind config to scan all HTML and JS files inside src/ and its subfolders.

A["./src/**/*.(html|js)"]
B["./src/*.{html,js}"]
C["./src/**/.*.{html,js}"]
D["./src/**/*.{html,js}"]
Attempts:
2 left
💡 Hint

Remember the correct glob pattern syntax for matching multiple file extensions.

rendering
advanced
2:00remaining
What happens if you omit the content configuration in Tailwind CSS?

Consider a Tailwind project with no content paths set in tailwind.config.js. What will the generated CSS file contain?

AThe CSS file will include all Tailwind styles, making it very large.
BThe CSS file will include only default colors but no utilities.
CThe CSS file will be empty because no files are scanned.
DThe build will fail with an error about missing content paths.
Attempts:
2 left
💡 Hint

Think about what Tailwind does when it does not know which classes you use.

selector
advanced
2:00remaining
Which content pattern excludes node_modules but includes JSX files in src?

Choose the content array that scans all JSX files in src/ but excludes node_modules folder.

A["./src/**/*.{jsx}", "!./node_modules/**/*"]
B["./src/**/*.jsx"]
C["./src/**/*.{jsx}", "./node_modules"]
D["./src/**/*.{jsx}", "!./node_modules"]
Attempts:
2 left
💡 Hint

How do you exclude a folder in glob patterns?

accessibility
expert
2:00remaining
How does proper content configuration improve accessibility indirectly?

Why can correct content configuration in Tailwind CSS help improve accessibility of your website?

ABy reducing CSS file size, pages load faster, improving user experience for all including assistive tech users.
BBy disabling animations that cause motion sickness.
CBy generating keyboard navigation styles by default.
DBy automatically adding ARIA labels to all elements.
Attempts:
2 left
💡 Hint

Think about how performance affects accessibility.