主权项 |
1. A computer-implemented method for a cascading style sheet (CSS) rule optimization, comprising:
generating, by one or more computing devices, a template tree associated with a template file with a parser, the template file including one or more templates; generating, by the one or more computing devices, a CSS tree associated with a CSS file with the parser, the CSS file including at least one or more CSS rules; traversing, by the one or more computing devices, the template tree and the CSS tree with an optimizer, wherein the traversing further comprises:
for each node in the template tree, identifying a reference to one or more CSS nodes in the CSS tree;if the reference exists, reconstructing a CSS rule from the one or more CSS nodes;appending the CSS rule to the node in the template tree; andcompiling, by the one or more computing devices, the appended template tree with a compiler.
|