SCSS Introduction

I'm a full-stack developer from South Africa πΏπ¦. I love writing about JavaScript, HTML and CSS.
Search for a command to run...

I'm a full-stack developer from South Africa πΏπ¦. I love writing about JavaScript, HTML and CSS.
No comments yet. Be the first to comment.
Most of you know me for my consistency, a golden arrow in my blog series. I've written 1000 articles in 1008 days! Almost an article a day, and my honeymoon was the only holiday I ever took. I'm super proud of this achievement; it has been a fantasti...

It's not the first time I'll be talking about community. I think it's an essential aspect of any successful tool. This shows in my previous explorations of Astro, Medusa, and now Vendure as well. All these products thrive in a super open, welcoming, ...

The cool part about Vendure is how easy it is to set up and how abstract each layer is. Basically, we get the following elements: External database Server Worker Admin UI Frontend While this is amazing, it also brings a bit of complexity when it co...

The previous article looked at customizing Vendure on a data and process level. In this article, we'll look at customizing emails, as they are often a big part of a webshop system. We'll be looking at two different layers of customization for customi...

Even though Vendure is a pretty significant project out of the box, in some cases, we might want to go in and modify some elements to work to our specific use case. In this article, I'll take a high-level look at some elements we can customize within...

Hey Guys, I realized I've been using SCSS in most of my Codepens. But we never really touched based on this topic.
So let's dive into introducing SCSS to you all.
BTW: I have a free Giveaway on Twitter! π¨ Free Giveaway
It stands for sassy css and is basically the follow up for SASS stylesheets. You will find many people calling it SASS or SCSS, but either way, they are very similar and used for modular CSS setup.
In general, some common use cases are:
We won't be going through all these topics today, but I will touch base on them during the next couple of days.
A major thing to keep in mind is that a browser won't understand SCSS or SASS code. We need to process it and turn it into regular CSS files.
There are several ways to do this; the simplest is using a pre-processing plugin, for instance for Visual Studio:
This will run in Visual Studio and compile your SCSS files into one CSS file.
There are also specific SASS compilers see the website for more information:
Let's get right in there with a very basic example:
<div class="container">
<div class="box">
π€© SCSS π€©
</div>
</div>
$primary: #ffd670;
$secondary: #ff9770;
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: $primary;
}
.box {
background: $secondary;
padding: 50px;
border-radius: 20px;
color: $primary;
font-size: 2rem;
font-weight: bold;
}
As you can see, we can now quickly change our colors, instead of having them repeating in every element styling.
This will result in the following Codepen.
Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter