Automated refactoring for size reduction of CSS Style Sheets
Document typeBachelor thesis
Rights accessRestricted access - author's decision
Cascading Style Sheets (CSS) is a standard language for stylizing and formatting web documents. It plays an increasingly important role in web user experience. However, developers tend to write CSS from a result driven point of view, not paying a lot of attention to the CSS file structure as long as it produces the desired results. To obtain the intended output in the browser, developers usually debug a CSS file on a particular document instance. Nevertheless style sheets normally apply to a set of documents, so modifications added while focusing on a particular instance might affect other instances from the set. We present a first prototype of static CSS semantical analyzer and optimizer that is capable of automatically detecting and removing redundant property declarations and rules. We build on earlier work on tree logics to locate redundancies due to the semantics of selectors and properties. Existing purely syntactic CSS optimizers might be used in conjunction with our tool, for performing complementary (and orthogonal) size reduction, toward the common goal of providing cleaner and easily debuggable CSS files.