The user is asking for a CSS architecture design using the ITCSS methodology by Harry Roberts, specifically focused on scaling for large projects. I'll need to explain the architecture clearly, covering the directory structure, layers (Settings, Tools, Generic, Elements, Objects, Components, Utilities), and file naming conventions, possibly using BEM. It would be great to include examples, detail integration with build tools like Sass and PostCSS, and mention best practices for documentation, linting, and developer experience.Proposing an ITCSS CSS Architecture
I'm thinking about proposing a robust architecture design for the user’s large project using ITCSS. I should start by outlining goals and providing an overview of ITCSS, emphasizing its benefits. I'll define each layer's responsibilities, contents, and naming conventions, and offer an example folder structure. I need to discuss using preprocessors like Sass or PostCSS while ensuring the methodology remains flexible. Also, I'll include guidelines for large teams, addressing the interplay between Components and Utilities, bundling strategies, and avoiding utility explosion.Proposing a Tech-Agnostic Front-End Architecture
I want to propose a front-end architecture that’s tech-agnostic but still applicable for large Single Page Applications (SPAs) using frameworks like React or Vue. My structured approach will cover several key elements, starting with principles and goals, then a recap of ITCSS. I'll outline the folder structure and how imports will work. For each layer, I’ll detail responsibilities, from design tokens in Settings to helper classes in Utilities/Trumps. This structured format will help keep everything clean and manageable.Detailing Naming and Structure for ITCSS
I need to outline naming conventions and prefixing, using examples like .o-, .c-, .u-, and thematic classes like .t-. I also want to illustrate the flow from design tokens to components, such as using button styles. Responsiveness will include breakpoints and media query mixins. Theming will involve separate settings with CSS variables in :root and .theme-dark, which components can consume. For large projects, I’ll touch on governance, including linting with stylelint, documentation, and PR guidelines. I'll present everything sharply and directly, ensuring a strong foundation. Below is a practical ITCSS-based architecture you can drop into a large project and scale with multiple teams.
1. Goals of this architecture
Predictable cascade and specificity.
Clear “place for everything” → easier onboarding and refactoring.
Minimal side-effects and regressions as the codebase grows.
Supports design tokens, theming, and component libraries.
2. ITCSS recap (layers)
ITCSS = “Inverted Triangle CSS” – from low-specificity / global at the bottom to high-specificity / explicit at the top.
Ordered from first loaded → last loaded:
Settings – design tokens, variables.
Tools – functions, mixins; no direct CSS output.
Generic – resets, Normalize, base box-sizing, etc.
Elements – styling of bare HTML elements (h1, a, input, …).
Naming:.o-* for layout, .c-* for UI pieces, .u-* for helpers, .is-/has-* for states.
Tokens & theming in Settings; Tools for mixins/functions; Components consume tokens and Objects; Utilities for overrides.
Rules & linting to keep layers clean and avoid specificity wars.
If you share your tech stack (Sass vs PostCSS, React vs Vue, etc.), I can adapt this into a more concrete project skeleton (including example build config and a starter set of Objects/Utilities).