I suspect this issue can arise often in large projects.
Often, we begin our css file by borrowing one from a previous project whereupon we try to get rid of any rules not needed in the new project.
If we miss any, they will probably not cause a problem since you can have as many unused rules as you would like in a css file — it works with extra stuff!
Supposing you wish to eliminate all unneeded rules — other than be sharp-eyed, what is the recommended way?
Is there anything like “tidy” (for HTML) that helps us with CSS?
Hi.
Ray.
I’m sure there is some software that does that with websites.
However, I don’t know how to do that automatically in our local files.
I found this article: https://www.keycdn.com/blog/remove-unused-css
That explains how to detect unused CSS. Then, you can delete it manually.
I hope this helps.
Regards,
Sara
Sara;
Thanks. I looked over the reference you provided — some useful stuff there!
What led me to ask the question was the unused CSS in Project 4.3 (WiFi Manager for Web Server) in “Build Web Servers with ESP32 and ESP8266”.
It’s not significant since it’s only one rule, but it sparked my interest, so I thought it best to ask.
The CSS in question has a rule for a class “value” which isn’t used in this project.
I believe the CSS was borrowed from Project 4.1 or 4.2 as opposed to Project 2.1.
As usual, I just can’t get over how good this course is — I’m glad I signed up!
I’m moving right along with my studies:
On this course, I have to do 4.3, 4.4 and 4.5 and then I’m finished. I already did the EXTRA projects.
On the previous course, “Learn ESP32”, I have to do the EXTRA UNITs and then I’m done with that one.
I also purchased the 2 Automation courses — don’t know which one to start first?
Thanks again for all the good work.
Ray