2012-07-12 2 views

답변

0

부울 변수를 만들고 if 문에 코드 행을 래핑 할 수 있습니다. 예 :

// common.scss 

$include_extra_css: true; 

// global css here 

@if $include_extra_css { 

    // special css here 

} 

그런 다음 프로젝트별로 $ include_extra_css의 값을 변경하십시오.

그러나 common.scss가 다른 주 Sass 파일로 가져 오는 부분 (_common.scss) 인 경우 더 좋을 것입니다. 이렇게하면 변수에! default 플래그를 사용하고 모든 프로젝트에 대해 common.scss의 값을 수정하지 않고 가져 오는 파일의 값을 변경할 수 있습니다. 직접 컴파일 Sass 파일을 다른 직접 컴파일 Sass 파일로 가져 오는 것은 나쁜 습관입니다. 그래서처럼!의 http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#variable_defaults_

:

// common.scss 

$include_extra_css: true !default; 

// global css here 

@if $include_extra_css { 

    // special css here 

} 

// otherfile.scss 

$include_extra_css: false; 

@import "_common.scss"; 

여기에 기본에 말대꾸 문서입니다

관련 문제