가드 절이있는 믹스 인을 가지고 있습니다.덜 가드가 예상대로 작동하지 않습니다.
나는 가이드를 따라 왔으며 아래 구문이 정확하다고 생각합니다.
본질적으로 가이드는 @palette가 맞춤 색상 범위 중 하나이고 @color가 세트의 숫자임을 보장해야합니다.
이 기능은 컴파일되고 올바른 출력을 생성합니다.
그러나 @palette 변수를 변경하여 오류가 발생하면 Less는 컴파일되지 않습니다. 예상되는 동작입니까? 이런 식으로 호출
.AccentPalette(@palette; @color:500) when
(@palette = amber), (@palette = blue), (@palette = blueGrey), (@palette = cyan), (@palette = deepOrange),
(@palette = deepPurple), (@palette = green), (@palette = grey), (@palette = indigo), (@palette = lightBlue),
(@palette = lightGreen), (@palette = lime), (@palette = orange), (@palette = pink), (@palette = purple),
(@palette = red), (@palette = teal), (@palette = yellow) and
(@color = 50), (@color = 100), (@color = 200), (@color = 300), (@color = 400),
(@color = 500), (@color = 600), (@color = 700), (@color = 800), (@color = 900) {
.Swatch(@palette);
@accentColor:"@{@{color}}";
@accent50: @50;
@accent100: @100;
@accent200: @200;
@accent300: @300;
@accent400: @400;
@accent500: @500;
@accent600: @600;
@accent700: @700;
@accent800: @800;
@accent900: @900;
}
:
.AccentPalette(indigo);
견본 예 - 그들 중 다수, 각 색상 하나가있다. 나는 내 이전 코멘트에서 말을 달리
.Swatch(amber)
{
@50: #fff8e1;
@100:#ffecb3;
@200:#ffe082;
@300:#ffd54f;
@400:#ffca28;
@500:#ffc107;
@600:#ffb300;
@700:#ffa000;
@800:#ff8f00;
@900:#ff6f00;
}
* 적은 컴파일시 * 오류가 발생합니까? – Justinas
매우 유익하지는 않습니다. 컴파일 할 때마다 -1을줍니다. ServiceStack Bundler를 사용하여 asp.net 웹 사이트에 통합하고 있습니다. –
여기에 게시 한 코드는 50-900 변수가 선언 된 경우 컴파일러 오류가 발생하지 않아야합니다. 문제는'.Swatch (...) '일 수도 있습니다. 믹싱 코드를 질문에 포함시킬 수 있습니까? – Harry