Identify duplicate styles css [duplicate]

一笑奈何 提交于 2019-12-12 05:02:01

问题


I've been using the "Emmet Livestyle" plugin lately, and its been flawless. But on the last commit to my github project I noticed that the css lines were duplicated* from 1446 to 3448. I then opened chrome dev tools and confirmed that there were like 3 same styles per one element. I suspect that plugin is the culprit to this problem.

I really need to remove the duplicates. But I don't know where they start or where they end as the file is pretty large.

Could you guys happen to know any online tool or sublime plugin that could help me with this ?

Thanks.


回答1:


I've had this exact same problem with LiveStyle with my files being duplicate somewhere around 4 different times. One file is now 4 times as long.

In searching for a solution I found a NodeJS plugin called css-purge. It IS the solution and as far as I know, the only solution. I guarantee it.

You can find it here CSS Purge Package Install Page. Be sure to install NodeJS properly on your system first. I'm on a Mac so these were my instructions. I'm still looking for a solution for fixing Live Style. It used to work flawlessly until this new dedicated app started causing problems.




回答2:


If you look at Chrome's Developer Tools (other browser's do this as well), you will be able to, not only see what styles are being applied to an element, but from where those styles are coming from:

Once, you know the source, a simple "Find" operation in your editor will track the rule down.



来源:https://stackoverflow.com/questions/36036857/identify-duplicate-styles-css

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!