CSS를 아름답고 효율적으로 사용할 수 있도록 도와준다. 🦄

SASS(SCSS)란?

SASS Basic

  1. $변수명: 값으로 선언하여 재사용이 용이하다.
$main-color: #fff;

.white {
	color: $main-color;
}

/* 변수에 저장할 수 있는 Data Type */
/*
Color - rgb(100, 39, 153), hsl(0, 30%, 100%)
Number - 8.11, 12, 10px
String - "potato", "tomato", span
Boolean - true, false
null
*/
  1. nesting, selector(선택자)를 다른 selector의 스코프에 포함시킬 수 있다.
.parent {
	font-size: 2rem;
	.children {
	font-size: 1.5em;
	}
}

/* 속성 뒤에 : 를 추가함으로 nesting 할 수 있다. */
.parent {
	font : {
		familly: lato, sans-serif;
		size: 14px;
		decoration: none;
	}
}
  1. @extend로 비슷한 코드를 가져올 수 있다.
.parent {
	padding: 30px;
	background: #000;
	color: #f00;
	box-sizing: border-box;
}
.child {
	@extend .parent;
	color: #0f0;
}
  1. @mixin / @include로 긴 코드를 함수로 만들어서 쓸 수 있다.
@mixin content() {
    background: #eeeeee;
    padding: 20px;
    border-radius: 5px;
    max-width: 500px;
    width: 100%;
    margin: auto;
}

.my-content {
    @include content()
}

VS Code Extension Settings

json 설정 참고 -

[SCSS] Live Sass Compiler 설정

SCSS IntelliSense, snippet