What is node-sass?

SASS (Syntactically Awesome Style Sheets) is an extended version of CSS. It enables a developer to create code in another language and translate it into CSS, and it compiles SASS to CSS at an incredible speed. It has introduced various new features like:

  • nesting
  • data variables
  • mixin functions
  • and many more!

Two syntaxes are available for SASS; the newer one uses the .scss extension and the older one uses the .sass extension.

Converting SASS into CSS

It is very easy to convert an scss file into a css file using this command on the terminal.

sass myStyle.scss myStyle.css

Remember: You need to install node-sass on your operating system.

Nesting

Nesting, where we can define CSS rules inside another rule, is introduced in this version.

Data Variables

Variables are also introduced for storing specific values. Variables are declared after the symbol.

Mixin functions

Mixin functions are used to store a certain set of reusable CSS rules.

Syntax

svg viewer
Copyright ©2024 Educative, Inc. All rights reserved