I want php to output the page, then go through the page adding all of the classes, ids, and tags, to an array. Then use that array to select the CSS rules that would apply and write a css file to be linked from the page.
This would create one css file that only has the rules used on that page.
I’m thinking of this because I audited a site that has 5+ stylesheets and styles in the head, of which an average of 90% of the rules are not being used on one specific page, while being needed on another. So about 150k of data is being transferred for no reason at any given time. Not to mention all of the server requests.