Reputation: 4427
Is there out any flag in the CoffeeScript compiler to add single-line coffee comments to Javascript output? I read some time ago it would be supported but it turns out this option still remains unavailable.
Upvotes: 3
Views: 1242
Reputation: 78
You can do a single line comment by making it plain JS, eg.
`// this will appear in the compiled JS`
Whether you should or not is a separate question :)
Upvotes: 0
Reputation: 7288
The easiest option is just to use block comments everywhere. A search/replace across your code base could take care of this in a trivially short time. You would change
# coffeescript one-line comment, not passed through to js
into this
### coffeescript block comment, which IS passed through to js ###
A harder option would be to mod coffeescript itself. For instance, the coffeescript lexer is very well documented, and shows that the logic used to identify block comments. By carefully modifying the lexer, I imagine you could convince it that your single line comments were block comments, which again, are already passed through to js. I haven't tried this, however.
Upvotes: 6