3

These 5 questions are nearly the same:

Is there a way to automatically remove unused CSS rules when building a Visual Studio project?

How to find and remove unused CSS by Chrome

https://stackoverflow.com/questions/70977251/how-to-detect-unneeded-css-rules-e-g-with-the-browerss-developer-tools

How to identify unused CSS definitions from multiple CSS files in a project

How can I find unused images and CSS styles in a website?

What's the best way to link each one to the 4 others? (this reminds me of the internet "Webring" era!)

Each of them have interesting answers, and no question / no answer should be deleted (or maybe only mine, the 3rd one).

By the way since these questions don't ask for third-party tools, but really built-in Chrome Developer tools, I think they really are on-topic:

if your question generally covers… software tools commonly used by programmers; and is a practical, answerable problem that is unique to software development …then you’re in the right place to ask your question!

Note: the lock on How to identify unused CSS definitions from multiple CSS files in a project is really problematic because not only can we not comment on current outdated answers and leave a note for future readers about new solutions, we also can't even vote existing comments. I think it should be re-opened, or at least, closed by not locked.

PS: all these questions show that this CSS / programming issue is really a common one, and should be addressed somewhere (ideally in a good canonical question+answer), rather than closed / locked everywhere.

17
  • iof there isn't a canonivcal question make one, and add all valid amswers with lonks to the orignals and then close all other as duplocates
    – nbk
    Feb 4, 2022 at 1:09
  • @nbk The fourth would be the best candidate as "canonical" but it is closed / locked, no longer accepting any interaction... so this is problematic
    – Basj
    Feb 4, 2022 at 1:11
  • 1
    Since Chrome cannot delete these rules from a CSS file I would argue that a 3rd party tool is required and so this is a recommendation request. Or else the answer is a simple "You can't".
    – Paulie_D
    Feb 4, 2022 at 8:02
  • 1
    You can make a question a duplicate of a locked question, @Basj .
    – Thom A
    Feb 4, 2022 at 9:20
  • 3
    @Larnu Yes, but this doesn't make any sense in this specific case: the target question doesn't accept any interaction, not even a comment on answers like "This is outdated, now use this instead: ...". Here it would be super inefficient in this specific context.
    – Basj
    Feb 4, 2022 at 9:22
  • I must ask, if the question is off-topic do we want a canonical duplicate? You say that How to identify unused CSS definitions from multiple CSS files in a project is the best target, but as it's locked it shouldn't be, but said question is off-topic, so making a canonical question for an off-topic subject feels wrong. It would be better to create a canonical duplicate on a site within the community where the question is on topic (if such a community exists). The fact that many people have asked the same off-topic question does not make it on-topic.
    – Thom A
    Feb 4, 2022 at 11:00
  • 1
    @Larnu It's not off-topic since it doesn't ask about third-party tools/libraries, here it's about Chrome Developer Tools. As mentioned here in my meta question: if your question generally covers… software tools commonly used by programmers; and is a practical, answerable problem that is unique to software development …then you’re in the right place to ask your question!
    – Basj
    Feb 4, 2022 at 11:03
  • Then why is How to identify unused CSS definitions from multiple CSS files in a project closed as off-topic, @Basj ? Perhaps what you are really asking for here is that said question be unlocked (and not closed) so that it can be the canonical duplicate?
    – Thom A
    Feb 4, 2022 at 11:03
  • 2
    @Larnu I think it's an example of bad closing / locking. stackoverflow.com/help/on-topic shows it well in this example.
    – Basj
    Feb 4, 2022 at 11:05
  • Which just cements my point. You say that How to identify unused CSS definitions from multiple CSS files in a project is a good canonical target, but because it's locked it can't be. So instead of posting a new canonical version of a question that is currently marked as off-topic, get the one you think is a good candidate unlocked. If the question gets unlocked, you get the result you want, if it's refused because it's off-topic then then your suggestion is also refused, as we should not be making duplicates of off-topic questions.
    – Thom A
    Feb 4, 2022 at 11:07
  • I can kind of see why that page is locked. The answer would have been useful over a decade ago, but in today's climate... no not really. That audit tool can't audit pages influenced by javascript on the go.
    – Gimby
    Feb 4, 2022 at 14:22
  • 1
    @Gimby I just spent a 1 hour using this tool, and it's still very useful, it helped me trim my CSS by more than 80% (I did carefully, checking responsiveness, etc.). The website I used has no JS (yes it still exists) except for basic user interaction.
    – Basj
    Feb 4, 2022 at 14:34
  • @Larnu There's no issue with using locked questions as dupe targets
    – TylerH
    Feb 10, 2022 at 14:43
  • I never said there was, @TylerH . I explicitly stated you can... it was the OP that was against it.
    – Thom A
    Feb 10, 2022 at 14:46
  • @Larnu I see, the "You say that How to identify unused CSS definitions from multiple CSS files in a project is the best target, but as it's locked it shouldn't be" bit was unclear from your comment above. Sorry!
    – TylerH
    Feb 10, 2022 at 14:48

1 Answer 1

1

Sorry I missed this. I have closed them all as duplicates of their appropriate targets. One was VS-specific, but the rest are duplicates of the two typical canonicals:

Note that the solution covered here, to use Chrome Dev Tools, does include instructions on removing the unused styles, not just identifying them.

5
  • Thanks @TylerH! PS: can you give a link to the precise answer which gives instructions about how to remove the unused styles with ChromeDevTools, and not just identify them in green/red? I have read all these questions/answers many times, but maybe I didn't see this specific part precisely :)
    – Basj
    Feb 10, 2022 at 14:47
  • @Basj The top answer on both of them stackoverflow.com/a/3113120/2756409 and stackoverflow.com/a/28497292/2756409
    – TylerH
    Feb 10, 2022 at 14:51
  • Oh I see @TylerH, you speak about Remove unused CSS rules? I also thought it would be a clickable button that would do the work, but in fact it's just an advice for the developer :) and it doesn't do the processing, it's just a text advice.
    – Basj
    Feb 10, 2022 at 14:58
  • @Basj Some of the answers there provide tool recommendations to do that for you, but if you are interested in specifically asking for such a tool that does that, that is off-topic... I think you and Larnu have already discussed that ad nauseum in the comments above.
    – TylerH
    Feb 10, 2022 at 15:02
  • This is already solved indeed @TylerH.
    – Basj
    Feb 10, 2022 at 15:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .