스타일 프레임 워크가 부트 스트랩 또는 Foundation 작업과 같은 방식을 이해해야합니다. 예 : plunker
다음은 프로젝트의 기본 구조입니다.
animation.scss // Your library
variables.scss // User custom variables
main.scss // User main scss file
이 파일을 살펴 보겠습니다.
Animation.scss
에는 필요한 모든 기본 변수와 모든 클래스가 있습니다. 이 클래스는 사용자가 별도로 가져올 수 있도록 믹스 인 (Mixins)으로 싸여 있습니다. 이 파일의 모든 변수에는 사용자가 변수를 무시할 수있는 플래그 !default
이 있습니다. 요소에 color 속성을 추가하는 간단한 클래스 animation
이 있습니다.
$color: green !default;
@mixin animation() {
.animation {
color: $color;
}
}
Variables.scss
에는 사용자 정의 변수가 들어 있습니다. 그들은 어떤 깃발도 가지고 있지 않습니다.
$color: red; // Note, there is no !default flag
Main.scss
은 모든 파일을 가져오고 일부 라이브러리 구성 요소를 포함합니다. 예를 들어 animation
이라는 구성 요소를 가져옵니다. 기본적으로
// Import library
@import 'animation.scss';
// Override library variables
@import 'variables.scss';
// Import components
@include animation();
요약
이 라이브러리는 green
의 값을 $color
변수가 있습니다. 사용자가 red
에 우선하며 구성 요소 animation
을 포함합니다. 따라서 animation
클래스의 모든 요소는 빨간색이어야합니다.