Migrating Cascading Style Sheets to Preprocessors by Introducing Mixins. Mazinanian, D. & Tsantalis, N. In Proceedings of the 31st IEEE/ACM International Conference on Automated Software Engineering, pages 672–683, New York, NY, USA, 2016. ACM. Invited to Special Issue of the Automated Software Engineering Journal
Migrating Cascading Style Sheets to Preprocessors by Introducing Mixins [pdf]Paper  Migrating Cascading Style Sheets to Preprocessors by Introducing Mixins [link]Link  doi  abstract   bibtex   
Cascading Style Sheets (CSS) is the standard language for styling web documents and is extensively used in the industry. However, CSS lacks constructs that would allow code reuse (e.g., functions). Consequently, maintaining CSS code is often a cumbersome and error-prone task. Preprocessors (e.g., Less and Sass) have been introduced to fill this gap, by extending CSS with the missing constructs. Despite the clear maintainability benefits coming from the use of prepro-cessors, there is currently no support for migrating legacy CSS code to preprocessors. In this paper, we propose a technique for automatically detecting duplicated style declarations in CSS code that can be migrated to preproces-sor functions (i.e., mixins). Our technique can parameter-ize differences in the style values of duplicated declarations, and ensure that the migration will not change the presentation semantics of the web documents. The evaluation has shown that our technique is able to detect 98% of the mix-ins that professional developers introduced in websites and Style Sheet libraries, and can safely migrate real CSS code.

Downloads: 0