Published May 1, 2015 | Version v1

refactorcss

Authors/Creators

Description

Cascading Style Sheets (CSS) is a language used for describing the look and formatting of HTML documents. CSS has been widely adopted in web and mobile development practice, since it enables a clean separation of content from presentation. The language exhibits complex features, such as inheritance, cascading and specificity, which make CSS code hard to maintain. Therefore, it is important to find ways to improve the maintainability of CSS code. In this paper, we propose an automated approach to remove duplication in CSS code. More specifically, we have developed a technique that detects three types of CSS declaration duplication and recommends refactoring opportunities to eliminate those duplications. Our approach uses preconditions that ensure the application of a refactoring will preserve the original document styling. We evaluate our technique on 38 real-world web systems and 91 CSS files, in total. Our findings show that duplication in CSS code is widely prevalent. Additionally, there is a significant number of presentation-preserving refactoring opportunities that can reduce the size of the CSS files and increase the maintainability of the code.

Files

FSE'14.csv

Files (30.7 MB)

Name Size Download all
md5:d6a0bc1c6c9020e95072d623380e8d66
30.7 MB Download
md5:a40c0cc8d7a3983a209168cc47ded631
9.1 kB Preview Download
md5:1fa9887b29b6d0fbede6f8d1fd09c3fc
238 Bytes Preview Download