sagold / handlebars-webpack-plugin

Renders your html-template at build time
162 stars 45 forks source link

Keep variables after compilation #59

Closed kevin-bog closed 2 weeks ago

kevin-bog commented 4 years ago

Hi, firstly, thanks for your work !

Everything works fine except, I would like to keep my variable {{}} after compilation. Because this is my controller which send data to my template how can i do this ?

Edit; Look like I couldn't do this. I had to handle this from the server and build one entry by partial ?

Thanks for taking the time

sagold commented 4 years ago

Hi.

Can you rephrase your question? What do you mean by "keep the variable {{}}"

And besides: Is this a question about handlebars or this plugin? If you have the an example of your input and expected output, i might be able to help.

kevin-bog commented 4 years ago

Hey,

sorry I meant,

I want to keep the handle bars variables : <p>{{ firstname }}</p> after the compilation, because after compilation, my variables are removed: <p></p>

Look like I made a mistake, and had to handle the rendering all from my serverside, without compiling the file

lamualfa commented 4 years ago

For me, just add backslash before your variable. Example:

Before compilation:

<p>\{{ firstname }}</p>

After compilation:

<p>{{ firstname }}</p>
xavierfoucrier commented 2 weeks ago

See https://handlebarsjs.com/guide/expressions.html#html-escaping.