Answer the question
In order to leave comments, you need to log in
Why doesn't the PUG mixin accept variables?
Mixin:
mixin img(name, ext, alt)
img(srcset='img/#{name}.#{ext},img/#{name}@2x.#{ext} 1.5x,img/#{name}@2x.#{ext} 2x', src='img/#{name}.#{ext}', alt='!={alt}')
+img('sail','jpg', 'alt text')
<img srcset="img/#{name}.#{ext},img/#{name}@2x.#{ext} 1.5x,img/#{name}@2x.#{ext} 2x" src="img/#{name}.#{ext}" alt="#{alt}">
Answer the question
In order to leave comments, you need to log in
mixin img(name, ext, alt)
img(srcset=`img/${name}.${ext},img/${name}@2x.${ext} 1.5x,img/${name}@2x.${ext} 2x', src='img/${name}.${ext}`, alt=`${alt}`)
+img('sail','jpg', 'alt text')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question