티스토리 뷰
mixins와 @extend의 compile 결과 차이
mixins
각 속성 설정을 @include한 선택자 내에 추가한다.
단점 - 같은 설정이 @include 할 때마다 중복되어 결과물의 크기가 커진다.
@extend(inheritance)
@extend한 선택자들을 모아서 그룹화하고, 속성 설정을 적용한다.
단점 - 관련 없는 선택자들이 그룹화된다.
https://medium.com/stories-from-the-keen/when-to-use-extends-vs-mixins-in-sass-b09d55abd53
When to use — extends vs mixins in SASS
SASS provides two main ways to reuse styles — @extend and mixins — this article is a brief look into how both work and which to use.
medium.com
mixins와 @extend를 언제 사용해야 하는가
동적으로 속성 정의가 바뀐다면 => mixins
정적으로 정해져 있어도 의미적으로 연관된 rule/selector가 아니라면 => mixins
이외의 경우 => @extend
@extend을 사용하면 연관되지 않은 선택자들이 그룹화 되어 순서가 엉키고, specificity(명시도)가 꼬일 수 있다.
또한, 성능도 mixins가 더 좋다.
https://csswizardry.com/2014/11/when-to-use-extend-when-to-use-a-mixin/
When to use @extend; when to use a mixin – CSS Wizardry – Web Performance Optimisation
20 November, 2014 When to use @extend; when to use a mixin Written by Harry Roberts on CSS Wizardry. Table of Contents When to use @extend When to use a mixin tl;dr tl;dr;tl;dr This is a question I get asked a lot by my clients: When should we use a mixin,
csswizardry.com
https://csswizardry.com/2016/02/mixins-better-for-performance/
Mixins Better for Performance – CSS Wizardry – Web Performance Optimisation
25 February, 2016 Mixins Better for Performance Written by Harry Roberts on CSS Wizardry. Table of Contents The Experiment Making Things More Realistic Mixins Are Better for Performance When it comes to preprocessors, one of the most frequent questions I
csswizardry.com
'Web 개발 > HTML,CSS' 카테고리의 다른 글
PostCSS vs Scss ? (0) | 2021.06.23 |
---|---|
HTML Semantics (0) | 2021.06.16 |
HTML | 기본 구조, meta tag, script tag (0) | 2021.06.07 |
HTML | DOCTYPE (0) | 2021.05.17 |
- rimraf
- file opener preference
- 스터디
- external editor
- 인증
- ModuleParseError: Module parse failed: Unexpected token
- ELIFECYCLE
- 인가
- node mkdir -p
- sass
- ECONNRESET
- node fs
- node cp -r
- createAction
- 프로그래머스
- node file package
- make-dir
- mkdirp
- fs-extra
- 자바스크립트
- 웹팩 에러
- JavaScript
- 페이지 특정 위치 link
- node rm -rf
- Storybook Error
- jest
- 스토리북 에러
- errno 253
- Webpack Error
- javascript event