Pug dynamic image src interpolation

16.6k Views Asked by At

I have stored a dynamic url link into a pug variable #{img}. Now I want to include that variable into my image element. Can anyone help me fill in the blank?

#{img} //some dynamic url
img(src=" ") //want to set src = #{img}
1

There are 1 best solutions below

1
On BEST ANSWER

do it like this

- var img = "img/test.jpg"
img(src=img)

and read this