I would like to add a new functionality to the project. Namely, I need to point the browser/monitor to a target web site to collect information which styles are actually in use. Then I can remove the styles that are not used from the .css files and thus reduce the size of .css files dramatically. This should improve performance of the target web site.
I haven't found a tool described above, so I am about to create it. And I would like to take CSSBox as the start point. Any thoughts on is it feasible?
All suggestions will be greatly appreciated.
Yours faithfully,
Oliver
Last edit: Rutishauser 2015-03-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I mean jStyleParser would be sufficient for this; you don't need CSSBox unless you are rendering the whole page. The DOMAnalyzer class in CSSBox just provides a simple interface to jStyleParser analyzer.
However, some extensions would be necessary. Currently, jStyleParser tracks which CSS rules are relevant for which DOM elements but it does not explicilty track the inverse relationship i.e. which DOM elements are releavant for which CSS declaration (if any). But you could probably do this externally -- go through the DOM tree with styles and mark the rules that are actually used. Additionally, you should probably do this for all the pages in the tested website.
Radek
Last edit: Radek Burget 2015-03-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear Colleagues,
I would like to add a new functionality to the project. Namely, I need to point the browser/monitor to a target web site to collect information which styles are actually in use. Then I can remove the styles that are not used from the .css files and thus reduce the size of .css files dramatically. This should improve performance of the target web site.
I haven't found a tool described above, so I am about to create it. And I would like to take CSSBox as the start point. Any thoughts on is it feasible?
All suggestions will be greatly appreciated.
Yours faithfully,
Oliver
Last edit: Rutishauser 2015-03-16
Hi,
I mean jStyleParser would be sufficient for this; you don't need CSSBox unless you are rendering the whole page. The DOMAnalyzer class in CSSBox just provides a simple interface to jStyleParser analyzer.
However, some extensions would be necessary. Currently, jStyleParser tracks which CSS rules are relevant for which DOM elements but it does not explicilty track the inverse relationship i.e. which DOM elements are releavant for which CSS declaration (if any). But you could probably do this externally -- go through the DOM tree with styles and mark the rules that are actually used. Additionally, you should probably do this for all the pages in the tested website.
Radek
Last edit: Radek Burget 2015-03-17