In this presentation you will see why the conventions (OOCSS, SMACSS, DRY and BEM) are important for your business, how you can to improve the performance, maintainability and solving problems/issues quickly for produce better web sites.
CSS are changing over time and today with several devices and responsive web design you need to have in your mind the best practices for create your CSS.
Obviously that we need to use a preprocessor (LESS, SASS, Stylus) because with the preprocessor you can to use variables, mixins, nested rules, inheritance, operations, extended and much more that will ease your life.
Naming Convention is very important in any language because clarifies intent.
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
Tech Headline - CSS Naming Conventions: Improve your code with OOCSS, SMACSS, DRY and BEM
1. 1/
CSS Coding Conventions
CSS Naming Conventions
Improve your code with OOCSS, SMACSS, DRY and BEM
Rodrigo Castilho aka RODCAST
Senior Front End Engineer
@rodcast
07/10/2014
3. / 3
Make a CSS better
Make it simple, short and above all describe what you are seeing.
4. 4/
HOW TO: Clean and Organize your CSS!
• Use a name that describes what you are styling
• Indents and Space (all lowercase)
• Avoid IDs selectors in CSS
• Minimize the depth of CSS selectors
• Use classes to define visual presentation patterns
5. 5/
HOW TO: Clean and Organize your CSS!
• Use a name that describes what you are styling
• Indents and Space (all lowercase)
• Avoid IDs selectors in CSS
• Minimize the depth of CSS selectors
• Use classes to define visual presentation patterns
6. 6/
HOW TO: Clean and Organize your CSS!
• Use a name that describes what you are styling
• Indents and Space (all lowercase)
• Avoid IDs selectors in CSS
• Minimize the depth of CSS selectors
• Use classes to define visual presentation patterns
7. 7/
HOW TO: Clean and Organize your CSS!
• Use a name that describes what you are styling
• Indents and Space (all lowercase)
• Avoid IDs selectors in CSS
• Minimize the depth of CSS selectors
• Use classes to define visual presentation patterns
8. 8/
HOW TO: Clean and Organize your CSS!
• Use a name that describes what you are styling
• Indents and Space (all lowercase)
• Avoid IDs selectors in CSS
• Minimize the depth of CSS selectors
• Use classes to define visual presentation patterns
32. 32/
The goals
Predictable, Reusable, Maintainable and Scalable.
Use best practices, make a simple and logic CSS with all experience and
continue learning and when possible refactor your code.
The more you learn the better you are, but there is always more learning to
be done and have in your mind, you can to change every time with
maintenance. In other scenario, have a standard independent of your choice.
The less time you spend with your CSS, more time you have to improve your
knowledge and your code.
33. 33/
Don’t forget
Never stop refactoring your code,
otherwise you'll have to fix a lot of broken
windows sooner than you think.