June 1, 2016. Oslo, Norway. 30min.
CSS preprocessors like Sass add a vaiety of functions that streamline CSS development: variables, nesting, functions, mixins, etc. The documentation is great, the tools are mature, and starting a new project using Sass has a clear and straight-forward workflow. But transitioning a large legacy codebase from CSS to Sass is a different story. CSS syntax errors that may be harmless in production can completely prevent Sass from compiling. But fixing those errors creates a far juicier problem: will we introduce visual bugs by fixing syntax bugs?
At Etsy we faced this exact question multiplied across over 400,000 lines of CSS and 2100+ CSS files. During this talk I'll discuss the considerations we had when approaching this project, cover the process of transforming CSS files using Abstract Syntax Trees (ASTs), some of the methodologies and tools we use to mitigate some of the biggest potential pitfalls of Sass (Sass live lint), how we ramped up our production services to gain confidence in our process and how this entire effort led to a single 1.2M line push that didn't break production and had minimal impact to developer and designer workflows.