pugjs / babel-plugin-transform-react-pug

A plugin for transpiling pug templates to jsx
MIT License
808 stars 46 forks source link

Can't figure out how to use locals without quotation marks #59

Closed nikita-skobov closed 6 years ago

nikita-skobov commented 6 years ago

I have a function that looks like this:

createPanel(obj) {
return pug`
 Card
   CardBody
       CardTitle '{obj.title}'
`
}

And that works, but it produces quotation marks around my title, so it shows up as 'My title here', when I just want it to say My title here without the quotes.

I've tried all sorts of various combinations like CardTitle= {obj.title} CardTitle #{obj.title} CardTitle= ${obj.title}

and all of those throw errors by either the pug-as-jsx-loader or the pug-lexer

ezhlobo commented 6 years ago

@nikita-skobov according to your code snippet and mentioned errors, I think you use pug-as-jsx-loader. I suggest you either create an issue in that repository or use current plugin.