2012-10-08 17 views
4

我想使用玉的coffeescript和###似乎沒有工作。而咖啡中的玉石塊級評論不允許我評論一系列的線條。它只是允許基於縮進的完整塊進行評論。有什麼建議麼???如何評論玉coffeescript

感謝

+0

你的意思是在你的玉文件中的CoffeeScript過濾器裏面? –

+0

是在咖啡腳本過濾器中添加註釋 – coool

+1

您確定您正確使用了###評論嗎?看看我的答案;) – Guillaume86

回答

4

###評論似乎爲我工作(所以你需要關閉它們,不要忘記這是多線評論):

!!! 5 
html(lang='en') 
    head 
    title App 

    body 
    :coffeescript 
     ### Comment ### 
     require "index" 
     ### 
     Comment 2 
     ### 

編譯爲:

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
    <title>App</title> 
    </head> 
    <body> <script type="text/javascript"> 

/* Comment 
*/ 

(function() { 

    require("index"); 

    /* 
    Comment 2 
    */ 

}).call(this); 
</script> 
    </body> 
</html> 
+0

您可能想要編輯您的答案,指出即使在單行註釋中,結尾符號###也是必需的。這可能是OP做錯了。 CoffeeScript中的'### ... ###'就像'/ * ... * /'在C中。要創建像'// ...'這樣的單行註釋,您可以使用單個散列,像這樣:'#...'。 – Quuxplusone

+0

Thx我將它添加到答案 – Guillaume86

+0

我認爲這是問題,它需要相應縮進..謝謝 – coool