How can I effectively clean up styles in a large web site?

后端 未结 5 2222
我寻月下人不归
我寻月下人不归 2020-12-01 02:03

Our web site has been under a constant development for a better part of the last five years. As it happens, pretty much all the styles for the site are in one big CSS file.

5条回答
  •  执念已碎
    2020-12-01 03:00

    I see there's not a good answer yet. I have tried the "Unused CSS online tool" and seems to work ok for public sites. The problem is if you have a CSS to show your public website + an intranet (for example: wordpress site + login for registered users). The intranet pages woun't be tracked and you will lose your css styles.

    My next try will be using gulp + uncss: https://github.com/ben-eb/gulp-uncss

    You have to define all the urls of your site (external and internal) and (maybe; not sure) if you are running the site with user + password on your browser, gulp+uncss can go inside the internal url's.

    Update: I see unused-css online tool has a login solution!

提交回复
热议问题