It seems that coffeescript compiler (at least at the year of 2013) will strip out single line comments started with #.
Yes, it can keep the block comments ###...###.
In those cases, lacking of the original source code may be useful, as people said from
"Please add single line comments to the compiled code. Even if you support some limited syntax of it its fully acceptable. Just support some easy common cases, thats it!
"Also people who are not familiar with cs reading generated code without single line comments is much harder."
Also it seems that there might be some difficulties in fixing this immediately in the current version of coffee-script: "To summarize: We'd love to do it, but we can't figure out how to parse 'em in order to preserve comment behavior, even in theory." "Sticking comments to the nearest tokens is easy. Propagating those to AST/compilation is the hard part."
So, here is an alternative way which allows one to compile the coffeescript but keep the original single line comments - anything after # will be replace to // in the output js file.
$ npm install coffee-utils
node coffee2js.js FILE1.coffee [ FILE2.coffee .... ] or coffee2js FILE1.coffee [ FILE2.coffee .... ]
Rather than dig into the original coffee-script compiler, since current coffee-script compiler supports block comments, so I use a clever approach - pre-process the coffee script and replace single line comments into block comments and feed into the coffeescript compiler, then post-process it to generate the final output. Isn't that interesting ?!
More test cases like edge cases or something like /* */ inside String