Jade Templates: Make an image a link

So in HTML i'd do something like this:

<a href="www.something.com">
    <img src="my/machine">
</a>

to make the image into a link. But I want to do the same for Jade. I was reading through the docs here but nothing relating to what I want. Help please? Thanks very much in advance.

Upvotes: 7

Views: 11143

Answers (2)

Sheev
Sheev

Reputation: 98

Use img(src= someExpr) where someExpr will be evaluated to the path to your image.

Upvotes: 0

technophobia
technophobia

Reputation: 2629

What you're doing is nesting elements. Nesting just requires new lines and a tab per nest level.

Jade:

a(href='www.something.com')
    img(src='my/machine')

Upvotes: 13

Related Questions