我想在输出的JavaScript文件中保持我在CoffeeScript文件中写的注释不变。我该怎么做?
#!/usr/bin/env bash
./node_modules/.bin/coffee --output lib/ --compile --bare --watch src/
来自咖啡脚本文档:
块注释反映了heredocs的语法,并保留在生成的代码中。
这(借用下面打字错误的回复-整洁!):
###*
# This will be preserved in a block comment in the javascript
###
编译为:
/**
* This will be preserved in a block comment in the javascript
*/
根据Linus的回答,我发现这是获得我想要的评论风格的最佳风格:
###*
# Hello world
# @param Object object
# @return String
###
添加第一个###
门会启动注释,而添加的*
会给我们
/**
* Hello world
* @param Object object
* @return String
*/