Since we're working on a complete rebrand, we're also creating all of our CSS from scratch. While we could have reused some of the existing styles, most of them didn't rely on variables, and had multiple implementations of the same things, so this change will allow us to achieve consistency much more effectively.

At the very core of our design system are clearly defined values - a set of base colours, spacers, font sizes, breakpoints, border radii, and box shadows. These are defined at the very top of [stylesheets/design](<https://github.com/gumroad/web/blob/develop/app/javascript/stylesheets/design.scss>). Every value that's used outside of this section should ultimately refer back to these in some fashion, unless it is very specifically and explicitly a hardcoded exception. This will allow us to easily change these values and have them immediately take effect across the entire project, and also give us theming basically for free - all a theme needs to do is change the values of those base colours, and everything else will automatically fall in line.

These values are then used by clearly defined components. Most of the elements on our pages, unless they truly are nothing more than generic containers setting some spacing, should refer back to one of our predefined components. This not only makes it easier to reuse, but it again allows us to make changes globally and consistently without having to find and touch all the specific places a component is used in.

Writing a component in CSS

Most of the components you're going to need should already be defined. If something seems to be missing, check with Maya and/or Jack first - there might be one of our existing components that already covers this use case, or should be adapted to match. If something is truly missing from the component gallery, we’ll want to add it there instead of doing something page-specific. For consistency, here are the principles that were used when writing them so far - and if you see something that you feel does not conform to these in the existing components, please fix it!

Migrating a page to the new design system

This section outlines the process of how to pick up, write and ship the migration of a page to the new design system.

If there are any problems with the migration, such as missing/incomplete components in the new system, or unresolvable incompatibilities between the old and new design systems, feel free to ask for help in the #rebrand channel.

Cleaning up

Right now, we're leaving all existing classes and image assets behind, as we need the existing design to continue functioning until we've migrated over all pages and switched them over in production.

Once we're ready to leave behind the old CSS and clean it up, we'll need to: