Tailwindcss - How to fix PHPStorm not autocompleting classes By micha on 13th August 2021 05:26:43 PM
Option 1 - file is purged
tailwind fix in next package release (see https://youtrack.jetbrains.com/issue/WEB-50369)
Autocompletion is just working if the purge option is not provided
// tailwind.config.js
module.exports = {
purge: {
enabled: true,
content: ['./src/**/*.html'],
},
// ...
}
Option 2 - file too big (phpstorm stopped indexing)
When the CSS file that Tailwind generates gets too big, PHPStorm will stop indexing it. If the file isn't indexed, autocompletion won't work for CSS classes.
If your CSS classes aren't being autocompleted, try opening the CSS file that Tailwind generates in your public/css/ directory. You should see a yellow banner that says: "The file size (4.03 MB) exceeds configured limit (2.56 MB). Code insight features are not available". If you see this yellow banner, you can fix the problem by doing the following:
- In the main menu toolbar, click Help > Edit Custom Properties...
- Add the following line: idea.max.intellisense.filesize=6000
- Restart PHPStorm
This custom property bumps the configured limit from the default 2500 KB to 6000 KB. After restarting your IDE, and after a few seconds of indexing, autocompletion should be working again.