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

Not detect string interpolation - babel-plugin-transform-react-pug #26

Closed
phmngocnghia opened this issue Jul 18, 2018 · 3 comments
Closed

Comments

@phmngocnghia
Copy link

phmngocnghia commented Jul 18, 2018

*string interpolation
Error : react-pug/no-broken-template
Code that got error: https://paste.ofcode.org/8SRSabwhEnQBwYeTNdEXDG
Transpilier use: https://github.com/pugjs/babel-plugin-transform-react-pug
Code that cause error:
div(className=${portfolioSection.projects > 0 ? '.mb-4' : ''})

@phmngocnghia phmngocnghia changed the title Not detect string interpolication Not detect string interpolation Jul 18, 2018
@phmngocnghia phmngocnghia changed the title Not detect string interpolation Not detect string interpolation - babel-plugin-transform-react-pug Jul 18, 2018
@ezhlobo
Copy link
Owner

ezhlobo commented Jul 19, 2018

@phmngocnghia thanks for reporting this. I was able to reproduce this behavior, will keep you updated.

@ezhlobo
Copy link
Owner

ezhlobo commented Jul 19, 2018

@phmngocnghia in the meantime you can see the better options of using pug in react: https://github.com/pugjs/babel-plugin-transform-react-pug#define-local-variables-and-use-javascript-in-attributes

Basically your example could be re-written this way:

div(class=portfolioSection.projects > 0 && '.mb-4')

div(class=portfolioSection.projects > 0 ? '.mb-4' : '')

@ezhlobo
Copy link
Owner

ezhlobo commented Jul 20, 2018

@phmngocnghia I've published new release: 0.3.2. Please, take a look at it and feel free to re-open this issue if it's not fixed.

@ezhlobo ezhlobo closed this as completed Jul 20, 2018
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

2 participants