Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Maintaining comments in .js files after compilation from .coffee

Maintaining comments in .js files after compilation from .coffee

Problem

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/
Problem courtesy of: typeoneerror

Solution

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
 */
Solution courtesy of: Linus Gustav Larsson Thiel

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Maintaining comments in .js files after compilation from .coffee

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×