Home » SASS warn Directive

SASS warn Directive

by Online Tutorials Library

Sass @warn Directive

Sass @warn directive is used when you get a problem and want to give a cautionary advice to the users. It displays the value of a SassScript expression to the standard error output stream.

There are two specific differences between @warn and @debug:

  • Warning can be turned off with the –quiet command-line option or the: quiet Sass option.
  • Sass @warn directive provides a printed output along with the message so that the user being warned where the warning is occurred.

Sass @warn Directive Example

Let’s create a SCSS file named “warn.scss”, having the following data.

Now, open command prompt and run the watch command to tell SASS to watch the file and update the CSS whenever SASS file is changed.

Execute the following code: sass –watch warn.scss:warn.css

It will create a normal CSS file named “warn.css” in the same directory automatically.

Sass Warn directive1

Output:

Sass Warn directive2

You may also like