BEM vs. SMACSS: Choosing the Right Approach for This Project #2
                  
                    
                      ByteB4rb1e
                    
                  
                
                  started this conversation in
                Mind Meld
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In exploring the most effective CSS methodology for this reference implementation, I compared BEM (Block-Element-Modifier) and SMACSS (Scalable and Modular Architecture for CSS). Here's a quick breakdown of the key points that guided the decision to prioritize SMACSS over BEM:
Why Not BEM?
block__element--modifier) to create modular and reusable components.However, it assumes components are always intended to be reused universally.
Why SMACSS?
.is-disabled,.is-active) are centralized in the Base layer, while context-specific styling (e.g., a tomato vs. coconut "rotting") is scoped within specific components or modules.Challenges with SMACSS
A notable challenge with SMACSS is ensuring consistency in applying universal state definitions while addressing context-specific requirements. For example: A
.is-rottenstate might need a global behavior (e.g.,pointer-events: none;) but should also account for visual differences between components like a "rotting tomato" or a "rotting coconut.". This is resolved by defining global states in base/ and extending them contextually in components/.Conclusion
While both methodologies are robust, SMACSS offers the flexibility and modularity needed for this project’s goals. The focus on scoping and clear separation of concerns makes it a better fit compared to the verbosity and reusability-first approach of BEM.
This decision isn’t a dismissal of BEM but rather a reflection of the priorities and philosophy of this reference. Let’s discuss further—do you agree, or do you see other challenges or benefits to consider?
Beta Was this translation helpful? Give feedback.
All reactions