| I _think_ it shouldn't be too much code.
For my rails project, I wrote a simple shell script[1] to get all unused css classes and remove it my hand in final step, to make sure i will not remove css classes that actually used (e.g pre-define and use in future, overriding of third party css class) The script basically does: 1. Use REGEX match all css classes, `cat` into one place 2. Read the class line by line and search in html,js files to see if this css is used (even support #addClass from js) 2.1 it also supports several class adding styles e.g. class="abc", class: "abc", :class=> 'abc' or even "xxx" class in this: class="abc xxx ijk" 2.2 People even do this in js: $modal.append($('<div class="modal-close-icon"></div>')); and the REGEX can also detect this lol. [1] https://gist.github.com/50kudos/3028fac585eda85aea9a You can adapt my REGEX, and custom your directory where those css files are in. Simply copy the code and save into your filename.sh, and can run safely because my script don't write any file of your project. |