This is the manifest of things I’ve learned about managing CSS in large, complex web projects during my many years of professional web development. I’ve been asked about these things enough times that having a document to point to sounded like a good idea.

I’ve tried to keep the explanations short, but this is essentially the tl;dr:

  1. Always prefer classes
  2. Co-locate component code
  3. Use consistent class namespacing
  4. Maintain a strict mapping between namespaces and filenames
  5. Prevent leaking styles outside the component
  6. Prevent leaking styles inside the component
  7. Respect component boundaries
  8. Integrate external styles loosely

Entradas relacionadas