Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pug dynamic image src interpolation

Tags:

pug

pugjs

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}
like image 495
David Avatar asked Dec 11 '22 08:12

David


1 Answers

do it like this

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

and read this

like image 95
Vladlen Samb Avatar answered Dec 15 '22 07:12

Vladlen Samb