0
0
Tailwindmarkup~5 mins

Purging unused styles in Tailwind - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is purging unused styles in Tailwind CSS?
Purging unused styles means removing CSS classes that are not used in your project to make the final CSS file smaller and faster to load.
Click to reveal answer
beginner
Why is purging unused styles important?
It reduces the size of CSS files, which improves website loading speed and performance, especially on mobile devices.
Click to reveal answer
intermediate
How do you configure purging in Tailwind CSS?
You add the paths of your HTML, JavaScript, and template files in the content array inside tailwind.config.js. Tailwind scans these files to keep only used classes.
Click to reveal answer
intermediate
What happens if you forget to include some files in the purge content paths?
Tailwind will remove classes used only in those files, causing missing styles and broken design in your website.
Click to reveal answer
advanced
How can you safely use dynamic class names with Tailwind's purge?
You can use the safelist option in tailwind.config.js to list classes that should never be removed, even if not found in scanned files.
Click to reveal answer
What is the main goal of purging unused styles in Tailwind CSS?
AReduce CSS file size for better performance
BAdd more CSS classes automatically
CChange colors of the website
DCreate new animations
Where do you specify which files Tailwind should scan for used classes?
AInside CSS files
BIn the HTML <head> section
CIn the <code>content</code> array of <code>tailwind.config.js</code>
DIn the JavaScript console
What can happen if you miss some files in the purge content paths?
AClasses used only in those files will be removed
BTailwind will generate errors
CThe website will load faster
DUnused classes will stay in the CSS
How do you keep dynamic class names from being purged?
AWrite them only in HTML files
BUse the <code>safelist</code> option in <code>tailwind.config.js</code>
CUse inline styles instead
DDisable purging completely
When is purging unused styles usually done?
ADuring development
BWhen editing images
CWhen writing HTML
DOnly in production builds
Explain how purging unused styles works in Tailwind CSS and why it matters.
Think about how Tailwind scans your files to keep only what you use.
You got /4 concepts.
    Describe how to handle dynamic class names so they are not removed during purging.
    Consider classes generated by JavaScript or templates.
    You got /4 concepts.