Skip to content

Draft: Add recommendation on scoped css

Savas Vedova requested to merge svedova/scoped-css into master

What does this MR do and why?

During our latest Frontend Department Meeting (internal link), we discussed using style tags directly inside the components.

Even though our styleguide suggests using utility-classes first, there are cases when we need to have more control and use component classes. In that case, our styleguide suggests moving the css into the page bundles.

The idea of this MR is to introduce a secondary solution, which suggests using scoped css. This approach has several benefits:

  1. It introduces automatic scoping
  2. The code is much more visible than page bundles. It occurred in the past that when we delete a css class, we may forget to delete css declaration.

In case of code duplication, or lack of functionality (such as access to scss vars) then we can move the css to the page bundles.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports