2011-04-05 4 views
3

master.less 파일을 사용하여 .less를 위해 필요한 모든 구성 매개 변수를 저장할 방법이 있습니까?변수 및 함수에 대한 DotLess (.less) master.less 파일

저는 현재 솔루션에서 각 .less 파일의 맨 위에 넣어야하는 다음 변수가 있습니다.

/* DOTLESS VARIABLES AND REUSABLE FUNCTIONS */ 
@brand_color: #9fdf40;        /* Primary MySite Green */ 
@Color: #696969;          /* Alternate Text Color */ 
@top_gradient: #80cc15;        /* MySite Green for TOP of GRADIENT */ 
@bottom_gradient: #9fdf40;       /* MySite Green for BOTTOM of GRADIENT */ 
@borders: #696969;         /* Standard Gray Border */ 
@light_borders: #DDD;        /* Lighter Gray Border */ 
@note: #ffffbe;          /* Yellow Notification Color (Also used for ad highlights) */ 
@font_family: Verdana, Arial, Helvetica, sans-serif; /*Standard MySite Font Family*/ 

.two-corner-radius(@radius){ 
    -webkit-border-top-left-radius: @radius;  /* Saf4+, Chrome */ 
    -moz-border-radius-topleft: @radius;   /* FF3.6+ */ 
    border-top-left-radius: @radius;    /* CSS3 */ 
    -webkit-border-bottom-right-radius: @radius; /* Saf4+, Chrome */ 
    -moz-border-radius-bottomright: @radius;  /* FF3.6+ */ 
    border-bottom-right-radius: @radius;   /* CSS3 */ 
} 

.gradient(@from:@top_gradient, @to:@bottom_gradient, @fallback:@brand_color) { 
    @ffgradient: "-moz-linear-gradient(center bottom, {0} 37%, {1} 72%)"; 
    @wkgradient: "-webkit-gradient(linear,left top,left bottom,color-stop(0.37, {0}), color-stop(0.72, {1}))"; 
    @iegradient: "progid:DXImageTransform.Microsoft.gradient(startColorstr='{1}', endColorstr='{0}')"; 
    @ie8gradient: "\"progid:DXImageTransform.Microsoft.gradient(startColorstr='{1}', endColorstr='{0}')\""; 

    background : @fallback;        /* for non-css3 browsers */ 
    background : formatstring(@ffgradient, @from, @to); /* FF3.6+ */ 
    background: formatstring(@wkgradient, @from, @to); /* Saf4+, Chrome */ 
    filter: formatstring(@iegradient, @from, @to);  /* IE6,IE7 */ 
    -ms-filter: formatstring(@ie8gradient, @from, @to); /* IE8 */ 
} 
/* END REUSABLE FUNCTIONS*/ 

지금 분명이 내가를 유지하기 위해 master.less 파일을 선언 할 수 있다면 그러나 그것은 훨씬 더 도움이 될 것입니다, (전통적 것 하나)는 CSS 내에서 각 변수의 각 인스턴스를 편집하는 데 이상 유지하는 것이 더 쉽습니다 변수 및 함수를 작성한 다음 모든 "하위".less 파일에 CSS CSS를 적용해야합니다. 내 master.less 파일을 가져올 수있는 @import 선언 거기에서 나는 현재 차례로 dotless.core.dll

답변

8

를 사용하여 내 .less 파일을 관리 할 수 ​​Chirpy을 사용하고

이 끕니다. 각 파일의 상단에이 파일을 넣고 파일에 포함 된 모든 함수/변수를 사용하면됩니다.

@import "E:\Projects\MyApp\UI\Assets\Css\master.less"; 

챔피언처럼 작동합니다.

+0

당신은 이미 이걸 찾은 것 같아요 :) – Tigraine

+0

무색의 문서에 대한 자세한 내용은 https://github.com/dotless/dotless/wiki를 방문하십시오. – Tigraine

+0

그래, 다른 방법을 찾고 있었다고 생각합니다. 나는 칙칙한 구성으로 그것을 선전하려고 노력했다. –