2013-02-28 80 views
3

我剛剛發現了一個奇怪的情況。 似乎有一個錯誤:僞選擇後LESS Mixin Bug:Pseudo Selector後

請檢查下面的代碼,看到內嵌批註

.nav-prev a{ 
    left:20px; 
    &:before { 
     top: 75%; 
     .chevron-line; 
     .rotate(); 
    } 
    // this mixin is causing an error and it wouldn't compile 
    &:after { 
     top: 25%; 
     .chevron-line; 
     .rotate (-45deg); 
    }​ 
} 

// // this is the fix applied for the previous error 
// .nav-prev a:after { 
// top: 25%; 
// .chevron-line; 
// .rotate (-45deg); 
// }​ 

.nav-next a{ 
    right:20px; 
    &:before{ 
     top: 25%; 
     .chevron-line; 
     .rotate(); 
    } 
    // strangely this one works and compile correctly 
    &:after{ 
     top: 75%; 
     .chevron-line; 
     .rotate (-45deg); 
    } 
} 

注:我用LiveReload編譯。

問題

這有什麼錯我的語法? 還是缺少一個bug? 或者它是一個編譯器錯誤?

謝謝你們。

回答

2

當我將你的問題代碼複製並粘貼到this compiler時,有一個隱藏的字符顯示出來,導致我的錯誤。這個字符是不存在在上面給出的.nav-next a的工作代碼中,所以它可能是罪魁禍首。

.nav-prev a{ 
    left:20px; 
    &:before { 
     top: 75%; 
     .chevron-line; 
     .rotate(); 
    } 
    // this mixin is causing an error and it wouldn't compile 
    &:after { 
     top: 25%; 
     .chevron-line; 
     .rotate (-45deg); 
    }​<--HIDDEN "DOT" CHARACTER SHOWING UP RIGHT HERE 
} 
+0

太好了,謝謝你的聯繫。 – ifdion 2013-03-02 02:22:44