3 ms·
How dynamic is your application? The answer is heavily dependent. If your application is mostly static, you can just use a tool that can convert CSS selectors t
by debacle 11y ago
How dynamic is your application? The answer is heavily dependent. If your application is mostly static, you can just use a tool that can convert CSS selectors to XPath selectors and scan your site for those elements. If your site is highly dynamic, the solution is much more difficult and likely involves a certain level of browser automation.
- brianwawok 11y agoWhat kind of tools do you suggest? Google shows me: https://davidwalsh.name/uncss https://davidwalsh.name/uncss (I think for dynamic) https://unused-css.com/ https://unused-css.com/ (I think also works for dynamic) and a bunch more
- debacle 11y agoYou could write a clever script in 50-100 lines. Most languages have css to xpath libraries.
- tmaly 11y agoinitially I would start with a static layout. I would want to optimize the css and what is actually used for both desktop and mobile. After that, I would convert the static layout to a dynamic template.
- Someone 11y agoEven that isn't as simple as it seems. Your site may have h3 elements, but that does not mean that your h3 rule will be used. Maybe all of your h3 elements are covered by more specific rules, such as ones checking for h3 in a div, or for h3 followed by a p.