Learn the Best and Most Useful SCSS

39 minutes

Have you ever wished for access to conditionals or iteration when writing styles? How cool would it be to use functions to write styles? SCSS has that and more! SCSS is a superset of CSS. Any valid CSS is SCSS, they even have the same syntax. SCSS borrows features from other languages to write smarter, reusable and more readable styles. This course will focus on how to use SCSS’s more useful features, compare them against each other and assess when their usage is appropriate.

pro-course-rss-logo

PRO RSS Feed

Transpile SCSS to CSS using node-sass

Organize SCSS into Multiple Files with Partials

Organize Styles with SCSS Nesting and the Parent Selector

Use SCSS Variables for Readable and Maintainable Stylesheets

Use Standard Built-in SCSS Functions for Common Operations:

Reuse Styles with the SCSS @mixin Directive

Reuse Styles with the SCSS @extend Directive

Write similar classes with the SCSS @for Control Directive

Loop Over Data with the SCSS @each Control Directive

Write Custom Functions with the SCSS @function Directive

css tutorial about Transpile SCSS to CSS using node-sass

Transpile SCSS to CSS using node-sass

0:45 css

In this lesson we learn how to set up SCSS and transpile your SCSS code into CSS with node-sass.

css tutorial about Organize SCSS into Multiple Files with Partials

Organize SCSS into Multiple Files with Partials

3:22 css

Tired of dealing with monolithic CSS files? Are requests for multiple CSS files hurting your performance? In this lesson we learn how to separate our styles with SCSS partials, and how SCSS imports compile to one file so there's only one request.

css tutorial about Organize Styles with SCSS Nesting and the Parent Selector

Organize Styles with SCSS Nesting and the Parent Selector

3:06 css

SCSS nesting can produce DRYer code by targeting child elements without having to write the parent class. Nesting up to 3 levels deep can help us understand relationships between styles. The SCSS parent selector represents the parent class, so it can DRY up targeting pseudo-elements/classes and be an asset for naming conventions. In this lesson we learn how to remove the redundancy of targeting pseudo-elements/classes, and child elements by taking advantage of SCSS’s nesting and parent selectors.

css tutorial about Use SCSS Variables for Readable and Maintainable Stylesheets

Use SCSS Variables for Readable and Maintainable Stylesheets

2:00 css

Updating the same color or metric multiple times is no fun. SCSS variables improve maintainability by allowing one name to represent a value that can be used anywhere. SCSS variables also give us the power of creating our own naming conventions to express the intent of specific values. In this lesson we learn how to use SCSS variables to assign user friendly names to colors/metrics so one value change will update that value in all the right places.

css tutorial about Use Standard Built-in SCSS Functions for Common Operations:

Use Standard Built-in SCSS Functions for Common Operations:

3:51 css

We can use javascript for color and opacity variations, math, list and map logic or to see if something exists. SCSS includes functions for a wide range of common use cases for logic in our styles. In this lesson we look at some of the more useful color functions to improve development velocity, readability, and simplify the code. Be sure to checkout all the SCSS functions: http://sass-lang.com/documentation/Sass/Script/Functions.html

css tutorial about Reuse Styles with the SCSS @mixin Directive

Reuse Styles with the SCSS @mixin Directive

5:24 css

Copy/pasting the same code is redundant and updating copy/pasted code slows development velocity. Mixins are reusable chunks of code that are included, similar to calling a function, instead of copy/pasted.

Mixins have some nice features:
- Arguments just like functions.
- Arguments can have default values and optional values.
- Named arguments allow us to use optional and default arguments when the mixin is included.
- Variable arguments allow us to have a dynamic number of arguments when the mixin is included.
- The @content directive allow us to add additional styles when the mixin is included.

In this lesson we learn how to DRY up the code with the SCSS @mixin directive and make copy/paste a thing of the past.

css tutorial about Reuse Styles with the SCSS @extend Directive

Reuse Styles with the SCSS @extend Directive

5:48 css

We can write reusable styles with the SCSS @extend or @mixin directives. Which one is better? It depends. A better question is, how do they differ?
Extends:
change the source order, mixins don’t.
maintain relationships, mixins don’t.
share inherited traits, mixins don’t.
can extend multiple classes, mixins don’t.
can create multiple class declarations in the compiled CSS, mixins don’t.
can use the placeholder selector, mixins don’t.

Mixins:
can accept arguments, extends don’t.
can pass additional content, extends don’t.
repeat code when compiled, extends group class names together.
work well wIth media queries, extends have a limited interaction wIth media queries.

In this lesson we learn about writing reusable styles with the @extend directive and how it compares to the @mixin directive.

css tutorial about Write similar classes with the SCSS @for Control Directive

Write similar classes with the SCSS @for Control Directive

5:10 css

Writing similar classes with minor variations, like utility classes, can be a pain to write and update. Sometimes just a single character is the only difference between classes and updating the defining parameter means we need to change it for every class name and value. We can write a class one time and the @for directive can write all the minor variations for us. If the similar classes need to be updated, with the help of the @for directive, they only need to be updated once. In this lesson we learn how to leverage the power of the SCSS @for control directive to relieve the pain.

css tutorial about Loop Over Data with the SCSS @each Control Directive

Loop Over Data with the SCSS @each Control Directive

5:06 css

The SCSS @for directive is great when we know how many iterations are required and we only need 1 variable. What if we need multiple variables to iterate over data sets? Hello SCSS maps and the @each control directive! In this lesson, we’ll check out iterating with lists and looping over data sets with maps and the @each directive.

css tutorial about Write Custom Functions with the SCSS @function Directive

Write Custom Functions with the SCSS @function Directive

5:14 css

Writing SCSS @functions is similar to writing functions in other programming languages; they can accept arguments and have return statements. SCSS provides a ton of great features, but sometimes we need to roll our own function. We can do that too! They’re useful when the desired functionality isn’t available from the built in SCSS functions and a mixin just won’t do. In this lesson, we learn how and when to use SCSS function directives.

Presented by:

Ari Picker

UI Guy, Dad, Ukulele Enthusiast

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?