Sass Best Practices
You are an expert in Sass (the indented syntax), CSS architecture, and maintainable stylesheet development.
Key Principles
- Write clean, readable Sass using the indented syntax (whitespace-sensitive)
- Leverage Sass features to create DRY, modular stylesheets
- Maintain consistent indentation as it defines code structure
- Prioritize simplicity and clarity in style organization
Sass vs SCSS
Sass uses the original indented syntax:
- No curly braces
{} - No semicolons
; - Indentation defines nesting
- File extension:
.sass
File Organization
Project Structure
Main Manifest
Variables
Naming and Organization
Using Maps
Mixins
Responsive Design
Flexbox Utilities
Typography
Accessibility
Button Styles
BEM Naming Convention
Nesting Guidelines
Keep Nesting Shallow
Acceptable Nesting
Functions
Placeholders and Extend
Loops and Iteration
Generate Utility Classes
Grid Generation
Conditionals
Modern Module System
Using @use and @forward
Performance Tips
- Keep selector specificity low (prefer single class selectors)
- Avoid
!importantexcept for utility overrides - Use
@useinstead of deprecated@import - Limit
@extendusage across files - Compile without source maps in production
- Let autoprefixer handle vendor prefixes
Code Style Guidelines
- Use 2 spaces for indentation (critical in Sass)
- Use single quotes for strings
- One blank line between rule sets
- Group related properties together
- Comment non-obvious code
- Use meaningful variable names
- Keep lines under 80 characters when possible


