---
title: "Discussion on \"Sass Explained: CSS With Variables, Nesting, and Logic\" | Hashnode"
description: "Discussion on \"Sass Explained: CSS With Variables, Nesting, and Logic\". Introduction\nCSS works, but it repeats itself: the same colour value in twenty places, the same media query copied again and again, no variables, no reuse. Sass, created by Hampton Catlin in 2006, is"
url: "https://hashnode.com/posts/sass-explained-css-with-variables-nesting-and-logic/6ae08188af6dbb194bbce43a"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Sass Explained: CSS With Variables, Nesting, and Logic](https://practicaldevblog.hashnode.dev/sass-explained-css-with-variables-nesting-and-logic?utm_source=hashnode&utm_medium=feed)

Introduction CSS works, but it repeats itself: the same colour value in twenty places, the same media query copied again and again, no variables, no reuse. Sass, created by Hampton Catlin in 2006, is

Oct 27 · 2 min read · practicaldevblog.hashnode.dev  
Updated Oct 30  
Read the article

-   [#sass](https://hashnode.com/tag/sass)
-   [#css](https://hashnode.com/tag/css)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)
-   [#beginner](https://hashnode.com/tag/beginner)

## Written by

[Waqas Shahid](https://hashnode.com/@practicaldevblog)

@practicaldevblog

  
[View profile](https://hashnode.com/@practicaldevblog)

Practical tutorials, tools, and tips for developers.

## Responses 2

Markdown supported · ⌘↵ to post

[Ethan Moore](https://hashnode.com/@ethanmoorenotes)

[Oct 29](https://hashnode.com/posts/sass-explained-css-with-variables-nesting-and-logic/6ae08188af6dbb194bbce43a/comment/6ae29b561b0d5501207ddf85)

The honest trade section is a fair summary: since native custom properties now cover the variables use case, the build step mostly pays off for mixins and partials. One tip for migrating gradually is to keep Sass variables for build-time values like breakpoints, but expose colors and spacing as CSS custom properties so they can change at runtime for theming. Do you cap nesting depth at two or three levels on bigger codebases?

[Waqas Shahid](https://hashnode.com/@practicaldevblog)

[Oct 29](https://hashnode.com/posts/sass-explained-css-with-variables-nesting-and-logic/6ae08188af6dbb194bbce43a/comment/6ae29b561b0d5501207ddf85#reply-6ae33dc0a689abae0d3f2052)

That’s a solid approach to gradual migration. Keeping breakpoints as Sass variables while exposing colors and spacing through CSS custom properties gives you the best of both worlds, especially when runtime theming is involved.

For nesting, I’d generally aim to keep it around two or three levels deep. Beyond that, selectors can become harder to follow and tightly coupled to the HTML structure. There are exceptions, of course, but if nesting keeps growing, it’s usually a good signal to simplify the selector or split the styles into smaller components.

Do you find that a strict nesting limit works well across a team, or is a shared guideline with code reviews enough?
