<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: NickdeK</title>
    <description>The latest articles on DEV Community by NickdeK (@namix).</description>
    <link>https://dev.to/namix</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1102205%2Ffe114888-d842-425b-ac88-df135bb9086b.png</url>
      <title>DEV Community: NickdeK</title>
      <link>https://dev.to/namix</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/namix"/>
    <language>en</language>
    <item>
      <title>SCSS or SASS; is it still relevant?</title>
      <dc:creator>NickdeK</dc:creator>
      <pubDate>Mon, 14 Jul 2025 14:34:56 +0000</pubDate>
      <link>https://dev.to/namix/scss-or-sass-is-it-still-relevant-46pa</link>
      <guid>https://dev.to/namix/scss-or-sass-is-it-still-relevant-46pa</guid>
      <description>&lt;p&gt;Last time &lt;a href="https://dev.to/namix/scoped-styling-and-the-history-of-css-scoping-2cog"&gt;I wrote about BEM&lt;/a&gt;, where it came from, how it’s used, and whether it still has any relevance today. In this post, I want to do something similar, but this time for SCSS/Sass.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is SCSS/Sass?
&lt;/h2&gt;

&lt;p&gt;SCSS/Sass is an extended CSS language library and a CSS preprocessor. It has multiple features that help with writing consistent, more readable, and reusable CSS.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's the difference between SCSS and SASS?
&lt;/h2&gt;

&lt;p&gt;Sass and SCSS both use the same tool to preprocess CSS. The precompiler is actually named Sass, and it can consume both &lt;code&gt;.sass&lt;/code&gt; and &lt;code&gt;.scss&lt;/code&gt; files.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.scss&lt;/code&gt; is essentially extended CSS syntax. This means you can write regular CSS, and it will work perfectly fine.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.sass&lt;/code&gt;, on the other hand, uses indentation instead of curly braces to define properties for a selector. This differs from standard CSS syntax, so you can’t write regular CSS in a &lt;code&gt;.sass&lt;/code&gt; file.&lt;/p&gt;

&lt;h2&gt;
  
  
  What features does Sass have?
&lt;/h2&gt;

&lt;p&gt;There are many features, but let me describe a few that are used frequently:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Nested selectors
&lt;/h3&gt;

&lt;p&gt;One of the most commonly used features is the ability to nest selectors. You can write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nc"&gt;.header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.logo&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;hotpink&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.header&lt;/span&gt; &lt;span class="nc"&gt;.logo&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;hotpink&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This might seem like a minor convenience, but in a large codebase, it can make a big difference. Some developers feel they can’t work without it, while others find it outdated, especially with component-driven development and scoped styling.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Mixins
&lt;/h3&gt;

&lt;p&gt;You can create reusable code blocks (similar to functions) that accept parameters and generate repeated styles with minor differences:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="k"&gt;@mixin&lt;/span&gt; &lt;span class="nf"&gt;node&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$color&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="nv"&gt;$color&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$black-40&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="mi"&gt;.5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nf"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$color&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nc"&gt;.selected&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$color&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="mi"&gt;.5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt; &lt;span class="m"&gt;4px&lt;/span&gt; &lt;span class="m"&gt;12px&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt; &lt;span class="nf"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$color&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="mi"&gt;.5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nc"&gt;.icon&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$color&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Variables
&lt;/h3&gt;

&lt;p&gt;You can define variables that can be reused throughout your styles:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nv"&gt;$black&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#000000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$black-80&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#231f20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$black-60&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#292929&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$black-40&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#363636&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In most cases, you can now use native CSS variables for the same purpose. I can't think of many use cases for this feature that aren’t possible with modern CSS.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Parent selector
&lt;/h3&gt;

&lt;p&gt;Sass includes a parent selector (&lt;code&gt;&amp;amp;&lt;/code&gt;) that references the current selector. This is especially powerful when combined with BEM-style naming:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nc"&gt;.button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$black-60&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nt"&gt;--large&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;18px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nc"&gt;.active&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;hotpink&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Imports
&lt;/h3&gt;

&lt;p&gt;You can import other Sass files, making it easy to split large stylesheets into smaller, reusable modules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="k"&gt;@import&lt;/span&gt; &lt;span class="s1"&gt;'variables'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;@import&lt;/span&gt; &lt;span class="s1"&gt;'buttons'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that CSS also has &lt;code&gt;@import&lt;/code&gt;, but it typically fetches styles at runtime, which can be slower due to additional network requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Relevance
&lt;/h2&gt;

&lt;p&gt;Sass is quite old, it was created in 2006 to help structure CSS more effectively, especially in large codebases. It was built in a time when component-driven development wasn’t really possible, and when CSS lacked many of the features we now take for granted.&lt;/p&gt;

&lt;p&gt;It’s still widely used, particularly in component frameworks like Vuetify and Quasar. Sass usage remains strong and stable (see the &lt;a href="https://stateofcss.com/en-US" rel="noopener noreferrer"&gt;State of CSS results&lt;/a&gt; from last year), and in some cases it's even increasing (see the number of &lt;a href="https://npmtrends.com/sass" rel="noopener noreferrer"&gt;npm downloads&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion and my opinion
&lt;/h2&gt;

&lt;p&gt;I really liked Sass back in the day. It finally allowed me to split up huge CSS files into more modular ones. Being able to use variables was awesome—no more designers breathing down my neck about slightly off colors, and no more massive refactors just to change a single shade. Even mixins were great when used properly.&lt;/p&gt;

&lt;p&gt;However, many of Sass’s features have since been adopted into the CSS standard. For example, CSS variables have been supported in all major browsers for quite some time now. And with modern web development becoming increasingly component-driven, CSS is naturally more modular anyway.&lt;/p&gt;

&lt;p&gt;As for the nesting feature, I’ve always had a love-hate relationship with it. On one hand, it’s great to nest selectors without repeating the same strings over and over. On the other hand, excessive nesting can lead to overly specific selectors and deeply nested code that’s harder to debug—especially when trying to trace a class from the DOM that was compiled from a nested structure.&lt;/p&gt;

&lt;p&gt;In practice, I find the long-term benefits of using Sass aren’t always worth the trade-offs. That’s partly because I tend to prefer native standards over tools that compile into them. It’s also because using Sass adds another compiler to the build pipeline, another “language” to learn, and another dependency to maintain (even if Sass itself rarely has breaking changes).&lt;/p&gt;

&lt;p&gt;So for me, I prefer to use vanilla CSS when possible.&lt;/p&gt;

&lt;p&gt;What about you? I’d love to hear your thoughts on Sass—its features, and its place in the future of web development.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>sass</category>
      <category>scss</category>
      <category>css</category>
    </item>
    <item>
      <title>Scoped Styling and the History of CSS Scoping</title>
      <dc:creator>NickdeK</dc:creator>
      <pubDate>Tue, 24 Jun 2025 20:17:29 +0000</pubDate>
      <link>https://dev.to/namix/scoped-styling-and-the-history-of-css-scoping-2cog</link>
      <guid>https://dev.to/namix/scoped-styling-and-the-history-of-css-scoping-2cog</guid>
      <description>&lt;p&gt;In my frontend development career of more than 10 years now (jeez, I’m old), I’ve come across a lot of frameworks, libraries, and languages. Recently, I had a discussion with some coworkers about why we should actually use Vue’s scoped styling feature. I figured it would be a good idea to write it down for future reference, and as my first blog post.&lt;/p&gt;

&lt;h2&gt;
  
  
  The scope of the discussion
&lt;/h2&gt;

&lt;p&gt;The conversation started when I began working on a few projects that used SCSS with Quasar in Vue. None of the components used scoped styling. Instead, everything followed the BEM naming convention. It worked, but in my opinion, it was cumbersome. I was used to simply adding the scoped attribute to the &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; tag, no need for BEM, and I never had issues with styling bleeding into other parts of the build.&lt;/p&gt;

&lt;p&gt;So that sparked a discussion: why were we still using these relics of the past in modern projects? Let me explain what my arguments were.&lt;/p&gt;

&lt;h2&gt;
  
  
  BEM
&lt;/h2&gt;

&lt;p&gt;BEM (Block Element Modifier) was introduced in 2005, and I (kind of) started using it about five years later. It was created to solve a problem: in large projects, styling would unintentionally bleed into unrelated parts of the site. Scenarios like two developers using the same class name in different features were common, often resulting in styling bugs after merging code.&lt;/p&gt;

&lt;p&gt;BEM introduced a structured naming convention based on blocks, elements, and modifiers, for example: &lt;code&gt;.form-input--disabled&lt;/code&gt;. This helped reduce conflicts by encouraging unique, descriptive class names. More importantly, it forced developers to think about naming in a consistent and predictable way.&lt;/p&gt;

&lt;p&gt;At the time, it worked well to reduce bugs and styling collisions. But personally, it never really clicked for me. While the concept made sense, in practice, I often struggled with deciding on names. It also added cognitive overhead, one more thing to remember and enforce.&lt;/p&gt;

&lt;h2&gt;
  
  
  Component driven development
&lt;/h2&gt;

&lt;p&gt;About 7 or 8 years ago, I started working professionally with modern frontend frameworks. At the time, Polymer was gaining traction, and since it came from Google, my tech lead decided we’d give it a try. Polymer was Google’s vision for Web Components, and you could argue that it helped shape the standards we have today.&lt;/p&gt;

&lt;p&gt;Like Web Components, Polymer used the Shadow DOM to render components. That meant each component had its own isolated DOM and scoped styles. CSS didn’t bleed in or out. And for the first time in my career, I could build five components, all with a &lt;code&gt;.header&lt;/code&gt; class, and each would behave completely independently.&lt;/p&gt;

&lt;p&gt;It was a revelation. I embraced component-driven development fully. Suddenly, I could build truly reusable components that I could copy and paste between projects and have them “just work” (well, mostly). I no longer had to think about naming things carefully to avoid conflicts. It was amazing.&lt;/p&gt;

&lt;p&gt;Of course, it wasn’t perfect. There are cases where global styling is needed, and in the early days of Polymer, it was hard to style inside Shadow DOM boundaries. The &lt;code&gt;::part&lt;/code&gt; selector didn’t exist yet, so we often had to write CSS in JavaScript objects and pass them manually into components.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scoped styling in Vue
&lt;/h2&gt;

&lt;p&gt;Vue gives us the ability to add a &lt;code&gt;scoped&lt;/code&gt; attribute to the &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; tag in single-file components. When you do this, Vue automatically generates a unique attribute (like &lt;code&gt;data-v-xxxxxx&lt;/code&gt;) and scopes all your CSS to that component by prefixing selectors with that attribute.&lt;/p&gt;

&lt;p&gt;It’s not as elegant as the native Shadow DOM model, but it gets the job done, and with fewer trade-offs. You can still use global styles when needed, and Vue provides the &lt;code&gt;:deep()&lt;/code&gt; selector to let you style parts of child components or override library styles.&lt;/p&gt;

&lt;p&gt;In my opinion, this eliminates the need for the often complex BEM naming convention. Scoped styles let you use clean, simple class names like &lt;code&gt;.header&lt;/code&gt;, &lt;code&gt;.button&lt;/code&gt;, or &lt;code&gt;.list-item&lt;/code&gt; without worrying about conflicts or global pollution. And for me, that simplicity is very welcoming.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;BEM was a great solution for a problem that existed in a different era of frontend development. But frameworks like Vue have changed the game. Scoped styles, whether through Vue’s system or the Shadow DOM, offer a cleaner and more maintainable way to write CSS in a component-based world.&lt;/p&gt;

&lt;p&gt;You can still use BEM if it works for your team, but in many cases, scoped styles are simpler, more intuitive, and just as safe. It’s one less thing to think about, and for me that makes quite the difference.&lt;/p&gt;

&lt;p&gt;What are your thoughts? Do you use scoped styling all the time or not at all? Please let me know in the comments below, I'm always happy to have some new insights 😊&lt;/p&gt;

</description>
      <category>vue</category>
      <category>css</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
