I'd like to keep the comments I write in my CoffeeScript files intact in the outputted JavaScript files. How can I do that?
#!/usr/bin/env bash
./node_modules/.bin/coffee --output lib/ --compile --bare --watch src/
From the coffee-script documentation:
Block comments, which mirror the syntax for heredocs, are preserved in the generated code.
This (borrowing from typeonerror's reply below - neat!):
###*
# This will be preserved in a block comment in the javascript
###
Compiles to this:
/**
* This will be preserved in a block comment in the javascript
*/
Expanding on Linus's answer above, I've found this to be the best style to get the comment style I wanted:
###*
# Hello world
# @param Object object
# @return String
###
Adding the first ###
gate starts the comment and the additional *
gives us
/**
* Hello world
* @param Object object
* @return String
*/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With