Removing unused CSS from website code

后端 未结 2 451
半阙折子戏
半阙折子戏 2021-01-17 09:50

I am currently modifying a website template which I have found for free on the web.

When i remove, for instance, a div from the code, the CSS for it rem

相关标签:
2条回答
  • 2021-01-17 10:27

    Intellij IDEA can do this. Navigate to CSS file, click on 'Analyze' and then reduce the analysis scope to a selected file. After that you will be presented with all problems related to this file. All errors are divided into categories, navigate to the category named 'Unused CSS selector' to find what you're after. The same should work for JavaScript. Please note that CSS support is only available in Ultimate version of IDEA, though it's totally worth every buck you spend on it. There is also a 30-day trial period for Ultimate edition. Oh, and by the way it has an excellent PHP support. There is also a cheaper PHP-specific IDE from the same vendor called PHPStorm. Analysis features are also available there.

    0 讨论(0)
  • 2021-01-17 10:40

    You can get pretty close to what you are asking for with the Google Chrome's Audit tab under Developer Tools. It does not remove unused CSS, but it will show you what CSS rules are not being used.

    Observe: enter image description here

    0 讨论(0)
提交回复
热议问题