what is scss file code example

Example 1: what is scss

SCSS is a preprocessor which lets you use features that aren’t a part of the wider CSS standard yet, and provides better workflows for maintaining your stylesheets.

With SCSS preprocessor, you can reduce the amount of times you repeat yourself and ensure you’re writing clean, maintainable code for the future.

Scss can take css code and work. 

SCSS is fully compatible with the syntax of CSS, while still supporting the full power of Sass.

Scss is an extension of the syntax of CSS. This means that every valid CSS stylesheet is a valid SCSS file with the same meaning. In addition, SCSS understands most CSS hacks and vendor-specific syntax, such as IE's old filtersyntax. This syntax is enhanced with the Sass features described below. Files using this syntax have the .scss extension.
Dry (dont repeat yourself) code is much better then wet code (write every time).

Example 2: scss file structure

> scss
    > base
		> theme									
          |- _richBlue.scss
          |- ...
        |- __base-dir.scss					#Import all base .scss files
        |- _bootstrap.scss        
        |- _variables.scss

    > components
        |- __components-dir.scss			#Import all components .scss files
        |- _header.scss
		|- _ie.scss
        |- _liquid-design.scss
        |- ...

    > global
        |- __global-dir.scss				#Import all global .scss files
        |- _busyloader.scss
        |- _scrollbar.scss
        |- _utilities.scss
		|- ...

    > icomoon								#Additional third party folders
		> fonts
		|- demo.html
		|- style.css

	
    styles.scss					#Import all dir files and third party folders

Example 3: Sass Tutorial

/* Define standard variables and values for website */
$bgcolor: lightblue;
$textcolor: darkblue;
$fontsize: 18px;

/* Use the variables */
body {
  background-color: $bgcolor;
  color: $textcolor;
  font-size: $fontsize;
}

Tags:

Misc Example