M
M
Maxim Gerasimenko2020-01-22 14:34:13
css
Maxim Gerasimenko, 2020-01-22 14:34:13

How to find unused css classes?

There is a site on WordPress. It is necessary to find and delete unused classes in style.css.
Can you please tell me if there is any online service? Or can you find it in a browser?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Druzhaev, 2020-01-22
@OtshelnikFm

Break the code into components - and then into the assembly. How the whole world of front-end collects
When you parse spaghetti css into sections, you will find unused styles.
But this is in a trio: css, html, js - this is the only way you will find it for everyone.
Another option - I see that css is smelly (no prefix, no BEM, etc.) - then I search for this name throughout the project. In code, layout in js - it will find all occurrences. If you can't find it, feel free to delete it. But - provided that you know how the project works. And then you will break firewood if there is a dependence on something from a third party.
css does not need to be cleaned. It must be divided into modules - files. And then there will be no mess. And merge all files with the same webpack

A
Alexander, 2020-01-22
@Seasle

Article for Chrome DevTools . However, if the test does not find an element with a class that is actually used, it will be marked as unused.

W
Warlynn, 2020-01-22
@Warlynn

Try this service

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question