Can PhpStorm / WebStorm remove unused css definitions in a css file?

Can PhpStorm / WebStorm remove unused css definitions in a css file? To actuallt remove them, not just identify them? I have tools which can identify them.

9 comments

Yes - using quickfix available from Inspections Results tool window:

Unused.png

1

Is this done for one css definition at a time? What if I have hundreds of unused definitions?

1

Select the 'Unused CSS selector' node in results and press the light bulb icon - quick fix will be applied to all files

fixAll.png

0

Why would the light bulb icon be disabled in my case? This is v11 EAP.

webstorm.png

1

No idea. May be, not all files unused selectors are found in are editable?

0

What do you mean not editable? Files which are read only? No it's not the case. Even if some files have some issue, the fix should be applied to the other files.

I should be getting some tootip help telling me what's going on and why I can't apply the global fix. Otherwise this is a bug.

1

Wooo +1 for Abdu on what should be!  I run in to this all the time, for example, "Unused import" has an auto fix, but "Import should be alphabetized" does not.  THERE IS NO OPTION TO FIX WHAT YOU CAN AND IGNORE THE REST!!! GAH!!!1111 . HAFADKFLJNDALK:FJHA:DSKL:AQ 

 

It's like someone had this GREAT IDEA, let's autofix common coding errors for developers.  Fantastic!  And then someone else came in the room and said "HOW CAN WE MESS THIS FEATURE UP?"

0

Did anyone find the solution? I have the same problem. They can be removed 1 by 1 but when I try to do it over the whole file it says "There are no applicable quick fixes".

0

Please sign in to leave a comment.