E
E
Evgeny Mikhailov2014-01-29 16:14:18
css
Evgeny Mikhailov, 2014-01-29 16:14:18

How to remove extra CSS selectors?

There is an html file 1.html to it there is a CSS file 2.css. 2.css has a lot of redundant selectors that are not used in the 1.html document. What service will automatically remove unnecessary selectors when loading these two documents?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
R
Ruslan Banochkin, 2018-01-03
@Banochkin

The developer tools in Google Chrome will help you find unused css styles. Here is the manual: https://banochkin.com/blog/clean-css/
If I clean the turnkey template, I just make a page where all the possible design options for the blocks on the site are displayed at once, and run the Chrome tool on it. That way you won't accidentally delete "unnecessary" styles.

I
Igor Vorotnev, 2014-02-19
@HeadOnFire

www.cleancss.com
https://github.com/peterbe/mincss
Personally, I prefer this procedure, like many others in the process, to be done using the magic Grunt - https://github.com/addyosmani/grunt-uncss

E
Egor Trubnikov-Panov, 2014-02-03
@EAT

intellij IDEA knows how to do this well, and also optimizes these same styles.
You need to select the Analyze -> inspect Code item on the analyzed document and you will be given all the shoals where you can automatically make BA-BACH !!!! extra selectors.

Z
zvorygin, 2014-01-29
@zvorygin

Chrome DevTools seems to be able to do this.

V
Vladislav Radu, 2014-10-31
@Vladislavradu

If you want to take a look - use the Google Chrome developer tools (Audits-Run). There was a case when it was necessary to remove a large number of selectors and I used an automatic program:
Dust-Me Selectors - an add-on for FireFox.
I did not find the best solution, everything worked quickly and efficiently.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question