-
Notifications
You must be signed in to change notification settings - Fork 47
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
Spread operators again #89
Comments
@mostrecent hey, thank you for this issue. For me that looks like a bug, but in fact, it just shows that pug doesn't understand new JavaScript syntax, while in the second case we use spreading outside of pug template. There is a workaround, you can still use And just in case, take a look how you can also write your code with pure pug. But in general I agree, that supporting of new js syntax inside pug will be a good idea. There is some workaround, and some discussion regarding that in pug repository: pugjs/pug#2921 |
Hey @ezhlobo, thanks for your reply and also providing a Pug-in-js REPL, this is awesome, I just had a good use for it! |
You can do this return pug`
${images.map((e, i) => {
return pug`
div.h-100.bg-green(
key=e.backgroundImage
css=${css(mq({
...e,
display: i == context.slideId ? 'block' : 'none'
}))}
)
`
})}
` |
I checked all the prior issues but I found a strange case where a spread doesn't work within pug (I am aware that attr values are pure JS).
Following doesn't work:
Following does work:
A bit context: css is emotion's css prop, css() is emotion's css helper, mq a media query helper from facepaint.
The text was updated successfully, but these errors were encountered: