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

Create New Objects with Template Tags #99

Closed
StabbarN opened this issue Mar 17, 2018 · 5 comments
Closed

Create New Objects with Template Tags #99

StabbarN opened this issue Mar 17, 2018 · 5 comments

Comments

@StabbarN
Copy link

Image

template tag

Something goes wrong when Naomi parses a temlate tag inside curly brackets, that is

someKey: myTag`${someVar}`,

turns all code after it to an incorrect color (in my case, with my theme, green).

Code sample

function myTag(strings, ...substitutions) {
  return 'something'
}

const someVar = 1

const l1 = {
  someKey: `${someVar}`, // This is ok
}

const dummy = myTag`${someVar}` // This is also ok

const l2 = {
  someKey: myTag`${someVar}`, // Can't have template tags inside object (curly brackets)
}
const everythingBelowAreGreen = 0
@2Pacalypse-
Copy link

I have a similar problem which I think is probably related (if it's not I'll create a new issue). The same effect happens if you have curly brackets inside a template tag, but only if it's also inside regular parenthesis as well.

For example, this:

const MyDiv = styled(Div)`
  margin: 0px;
  padding-right: 8px;
  line-height: calc(${standardIncrement} - ${barHeight});
  vertical-align: middle;
`

Results in:

naomi

@borela
Copy link
Owner

borela commented Mar 17, 2018

Both issues were related but in different parts of the syntax;
Fixed in https://github.com/borela/naomi/releases/tag/v3.12.3

image

@borela borela closed this as completed Mar 17, 2018
@2Pacalypse-
Copy link

Awesome, great work!

@borela
Copy link
Owner

borela commented Mar 17, 2018

Thank you both for isolating the issue, having the sample codes made it a lot easier to track the correct context.

@StabbarN
Copy link
Author

Thank you! That was quickly corrected!

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

3 participants