Systematically resolve conflicting styles in css

后端 未结 4 1103
长情又很酷
长情又很酷 2021-02-20 04:31

I have some stylesheets from different sources in my web project. I want to harmonize them. Some styles I need from the one, some from the other. Is there a tool or method how

4条回答
  •  执念已碎
    2021-02-20 04:50

    I threw together a quick script that can be helpful for detecting overlap of CSS rules from multiple sources: https://github.com/mgsloan/css-overlap

    As written it only works for stylesheets referenced by URL, but can very easily be adapted to handle inline stylesheets. It uses two regexes to split the stylesheets into two sets, and then scans every DOM node in your page looking for cases where some rules from both sets of stylesheets match.

提交回复
热议问题