Back to articles
You're Using 10% of SCSS. Here's What You're Missing.

You're Using 10% of SCSS. Here's What You're Missing.

via Dev.to WebdevOlexandr Uvarov

Let's be honest. Most SCSS files in most projects look like this: $primary : #ff69b4 ; $border-radius : 8px ; .card { color : $primary ; border-radius : $border-radius ; & __title { font-size : 18px ; } } Variables. Nesting. Maybe a mixin or two. That's it. Meanwhile, this is also SCSS — a music visualizer with 16 independently animated bars, over 1,600 generated keyframe declarations, and zero JavaScript: That's ~30 lines of SCSS generating what would take hundreds of lines to write by hand. It uses features that most developers never touch: @for , random() , nested loops, dynamic @keyframes . SCSS is a programming language. Let me show you the 90% you're probably not using. Each — Iterate Over Data Structures The problem: Typography styles are a set of properties that always go together — font-size , font-weight , line-height . You define 10 variants and write each one out manually. Add a property to a variant — hope you didn't miss a spot. Store font styles as maps and apply them wi

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
1 views

Related Articles