Skip to content

CLI: Options to control output of comments #4638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
danielbayley opened this issue Aug 10, 2017 · 4 comments
Closed

CLI: Options to control output of comments #4638

danielbayley opened this issue Aug 10, 2017 · 4 comments

Comments

@danielbayley
Copy link
Contributor

Now that #4572 has landed, it might be handy to be able to control the output of comments in the CLI.

I briefly started on a PR, but figured it would be a good idea to discuss first.

So, bike-shedding… maybe this could look like:

--no-comments		discard all comments in output
--block-comments	output ### block comments ### only

or maybe just --comments= where one of [ true, 'block', 'inline', false ] is given as the value (corresponding to output all comments, block comments only, line comments only, or output comments).

Thoughts?

@lydell
Copy link
Collaborator

lydell commented Aug 11, 2017

Why?

@GeoffreyBooth
Copy link
Collaborator

The last time command-line flags were discussed, the strong preference was to not add any more of them. Each one we add introduces more complexity, a need for more tests, etc. So if one is to be added, it needs a strong justification.

In this particular case, one could pipe the CoffeeScript compiler’s output through Babel with its comments: false option set, and the comments will be stripped out. Is there a reason that’s not good enough? With CoffeeScript 2 we’re intentionally not trying to duplicate Babel’s functionality, hence the output as ES2015 only without options for ES5 output etc. We’re leaving to Babel the things that it can do and that it already does well.

So if you’d like to make a case for why this is needed, please feel free and I’ll reopen if there’s consensus.

@nilskp
Copy link

nilskp commented Nov 25, 2017

@GeoffreyBooth I would really like to see this re-opened.

I use lots of comments that I don't want emitted in the Javascript output, nor do I need an additional transpiler step, which would make my workflow too slow.

Since retaining comments is a breaking change from CS1, it really ought to have been an opt-in feature to retain comments. However that's history now, so at the very least there should be an option to retain old behavior.

@GeoffreyBooth
Copy link
Collaborator

There are lots of breaking changes, but none of them are opt-in. We don't want the complexity of making this configurable, especially since it's so easily managed through other tools. We're not trying to reproduce Babel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants