You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once we have multiple image sources, we need a tool for generating the <picture> syntax. Ideally, these two tasks should both be automated and combined into one task. Maybe the optimal approach would be to have a task that parses content files (be it HTML or Markdown), detects “wild” <img> elements (not contained in <picture>) and then (1) generates the various image sources (based on a given configuration) and then (2) generates and injects the <picture> syntax, replacing the original <img>s.
Notes:
Instead of replacing all <img>s, we could use a flag: <img data-picture src="…">
The config could contain different named configurations, e.g. for images inside blog posts, for images in the side column, etc. and this config would be set on the images, e.g. <img data-picture="post">, <img data-picture="aside">. etc.
The text was updated successfully, but these errors were encountered:
@yoavweiss I was looking for a grunt plugin that could do that. Only found this one, though. Unfortunately, it deals with markdown files and uses the <picture> tag.
I ended up writing my own plugin for HTML files and srcset/sizes. Your article was my main inspiration. What do you think?
Once we have multiple image sources, we need a tool for generating the
<picture>
syntax. Ideally, these two tasks should both be automated and combined into one task. Maybe the optimal approach would be to have a task that parses content files (be it HTML or Markdown), detects “wild”<img>
elements (not contained in<picture>
) and then (1) generates the various image sources (based on a given configuration) and then (2) generates and injects the<picture>
syntax, replacing the original<img>
s.Notes:
<img>
s, we could use a flag:<img data-picture src="…">
<img data-picture="post">
,<img data-picture="aside">
. etc.The text was updated successfully, but these errors were encountered: