Answer the question
In order to leave comments, you need to log in
Is there a Gulp plugin for auto setting tag properties?
Hello everyone, I ran into the task of setting the properties of tags. There are Jade templates that don't specify ALT TITLE WIDTH HEIGHT. You need to somehow register them there by substituting the plugin into the JADE compilation script, because there are a lot of files! And somehow you need to calculate the WIDTH HEIGHT from the pictures, I also have no idea how to do it.
Has anyone seen a plugin with such a principle of operation? npm search turned up nothing, thanks everyone
Answer the question
In order to leave comments, you need to log in
How are you currently storing alt
and title
?
We can write a simple mixin
, to specify these properties in a pattern, then go through the files and replace everything img
with our mixin
.
mixin img(src, alt, title)
- var src = src || 'default-pic.png'
- var alt = alt || 'default';
- var title = title || '';
img(src=src alt=alt title=title)
width
did height
not work, but in theory, you can refer to fs. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question