2014-09-02 159 views
0

我已經提取了這段較少的代碼,當它運行一個異步任務來編譯這個較少的代碼時,會導致Web應用程序拋出一個錯誤。我從來沒有寫過較少的文章,也沒有從我對文檔的最初閱讀中減少,我似乎無法找到最新的錯誤。有人知道什麼是錯的? 這是錯誤:爲什麼這些代碼不能編譯?

ParseError: Unrecognised input in /Users/****/Desktop/testmoreless.css on line 4, column 3: 
3 
4 .core (@gridColumnWidth, @gridGutterWidth) { 
5 

這是整個代碼塊:

#grid { 

    .core (@gridColumnWidth, @gridGutterWidth) { 

    .spanX (@index) when (@index > 0) { 
     (~"[email protected]{index}") { .span(@index); } 
     .spanX(@index - 1); 
    } 
    .spanX (0) {} 

    .offsetX (@index) when (@index > 0) { 
     (~"[email protected]{index}") { .offset(@index); } 
     .offsetX(@index - 1); 
    } 
    .offsetX (0) {} 

    .offset (@columns) { 
     margin-left: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1)) + (@gridGutterWidth * 2); 
    } 

    .span (@columns) { 
     width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1)); 
    } 

    .row { 
     margin-left: @gridGutterWidth * -1; 
     .clearfix(); 
    } 

    [class*="span"] { 
     float: left; 
     margin-left: @gridGutterWidth; 
    } 

    // Set the container width, and override it for fixed navbars in media queries 
    .container, 
    .navbar-fixed-top .container, 
    .navbar-fixed-bottom .container { .span(@gridColumns); } 

    // generate .spanX and .offsetX 
    .spanX (@gridColumns); 
    .offsetX (@gridColumns); 

    } 

    .fluid (@fluidGridColumnWidth, @fluidGridGutterWidth) { 

    .spanX (@index) when (@index > 0) { 
     (~"> [email protected]{index}") { .span(@index); } 
     .spanX(@index - 1); 
    } 
    .spanX (0) {} 

    .span (@columns) { 
     width: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)); 
    } 

    .row-fluid { 
     width: 100%; 
     .clearfix(); 
     > [class*="span"] { 
     float: left; 
     margin-left: @fluidGridGutterWidth; 
     } 
     > [class*="span"]:first-child { 
     margin-left: 0; 
     } 

     // generate .spanX 
     .spanX (@gridColumns); 
    } 

    } 

    .input(@gridColumnWidth, @gridGutterWidth) { 

    .spanX (@index) when (@index > 0) { 
     (~"[email protected]{index}, [email protected]{index}, [email protected]{index}") { .span(@index); } 
     .spanX(@index - 1); 
    } 
    .spanX (0) {} 

    .span(@columns) { 
     width: ((@gridColumnWidth) * @columns) + (@gridGutterWidth * (@columns - 1)) - 10; 
    } 

    input, 
    textarea, 
    .uneditable-input { 
     margin-left: 0; // override margin-left from core grid system 
    } 

    // generate .spanX 
    .spanX (@gridColumns); 

    } 

} 
+0

可能還包括可變數據請(即@gridColumnWidth:XXXX) – haxxxton 2014-09-02 23:14:08

回答

1

看看這個answer

報價逐字答案:


這是文件原本有什麼:

(~"[email protected]{index}") { .span(@index); } 

後閱讀LESS change log,我發現,他們改變了語法,所以你現在可以直接使用變量不需要破解。所以我改變了我的mixin.less看起來像這樣:

[email protected]{index} { .span(@index); } 

有一對夫婦,你需要改變其他線路,但都遵循相同的格式。

(~"[email protected]{index}") { .offset(@index); }變化→ [email protected]{index} { .offset(@index); }