2012-10-08 20 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