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

wrong styled-components comments? #26

Closed
dan-dr opened this issue Jun 7, 2018 · 1 comment
Closed

wrong styled-components comments? #26

dan-dr opened this issue Jun 7, 2018 · 1 comment

Comments

@dan-dr
Copy link

dan-dr commented Jun 7, 2018

Commenting in styled-components with Ctrl + / yields:

body {
    ${'' /* background: red */}
  }

instead of

body {
    // background: red;
   // OR
   /* background: red; */
  }

same for Alt + Shift + A for multiline comments

Now there's an issue when trying to use variables:

body {
    // background: ${Colors.offBlack};
  }

the above will give a compilation error of something like Property value expected type of string but got null so only ${'' /* background: ${Colors.offBlack}; */} will work.

Maybe there's a way to identify when it's using variables in the tagged variables and choose which type of comment to put?

@michaelgmcd
Copy link
Owner

Sorry, I'm a little confused by your question. Why not use line comments when variables exist? Pressing Ctrl + / in my editor gives the correct behavior:

const StyledComponent = styled.div`
  ${'' /* font-family: ${myAwesomeVariable}; */}
  text-align: center;
`;

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

No branches or pull requests

2 participants