Skip to content
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

[CS2] Rewriter: Inline block comments in CSX not getting output #4629

Closed
microdou opened this issue Aug 4, 2017 · 3 comments
Closed

[CS2] Rewriter: Inline block comments in CSX not getting output #4629

microdou opened this issue Aug 4, 2017 · 3 comments
Labels

Comments

@microdou
Copy link

microdou commented Aug 4, 2017

JSX has a comment syntax {/* */}:

<div> {/* A JSX comment */} </div>

<div>
{/* 
  Multiline
  JSX comment
*/}
</div>

Currently there is no corresponding comment syntax in CSX yet. However, a workaround does exist, by using {`/* */`}:

# CSX
<div> {`/* A JSX comment */`} </div>
<div>
{`/* 
  Multiline
  JSX comment
*/`}
</div>

# converts to JSX
<div> {/* A JSX comment */} </div>;
<div>
{/* 
  Multiline
  JSX comment
*/}
</div>;

Should this workaround be documented, or implement a specific comment syntax for CSX?
It can be {### ###} or {# } or something else. There was some discussion on this topic in the depreciated CJSX jsdf/coffee-react-transform#41, and CJSX actually implemented the syntax {# }.

@GeoffreyBooth
Copy link
Collaborator

Regular block comments are allowed within CSX:

<div> {### A JSX comment ###} </div>

<div>
{###
  Multiline
  JSX comment
###}
</div>

Though they’re not getting output at the moment.

@microdou
Copy link
Author

microdou commented Aug 4, 2017

@GeoffreyBooth That's great! I didn't realize that its already in beta4.

@GeoffreyBooth GeoffreyBooth changed the title [CS2] Comment in CSX [CS2] Rewriter: Inline block comments in CSX not getting output Aug 5, 2017
GeoffreyBooth added a commit to GeoffreyBooth/coffeescript that referenced this issue Aug 24, 2017
…hat contain nothing but comments should not be optimized out
GeoffreyBooth added a commit that referenced this issue Aug 24, 2017
… only comments (#4659)

* Fix #4629: interpolations (whether in strings or CSX tags) that contain nothing but comments should not be optimized out

* Template literals need an expression inside their interpolations, so if we only have a comment to put in there, toss in an empty string as well
@GeoffreyBooth GeoffreyBooth added fixed and removed bug labels Aug 24, 2017
@GeoffreyBooth
Copy link
Collaborator

Fixed by #4659.

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

No branches or pull requests

2 participants