Replies: 2 comments 1 reply
-
A very good question and I must admit not very well explained in the docs. So imagetools "ends" with the import statement. // given code like this
<img src="path/to/image.jpg?w=480"/>
// which is really only sugar for this
import imageUrl from "path/to/image.jpg?w=480"
h('img', { src: imageUrl })
// image tools can manipulate freely what data gets stored in the `imageUrl` variable
// i.e.
<img src="... everything inside these to quotes can be handled by imagtools ..."/> For generating srcsets I've added the <img srcset="cool-pic.jpg?width=480;960;1920;3840&srcset" />
// into this
<img srcset="cool-pic.jpg 480w, cool-pic.jpg 960w, cool-pic.jpg 1920w, cool-pic.jpg 3840w" /> This directive only works with the width attribute for now though |
Beta Was this translation helpful? Give feedback.
-
Yes this information was essentially impossible to find in the docs. I still haven't found it, and I've read all the directives.md. I read the docs first, thinking I would find the answer to the README.md's claim of I found it now, literally at the bottom of https://github.com/JonasKruckenberg/imagetools/blob/main/docs/spec.md, with no explanation. Anyway the reason I'm replying here is I started reading the docs expecting this project to fill out And this questions asks "How much should I expect?" I realise my expectation is not spelled out anywhere in the readme/docs, so I might be a fool for expecting it - I think the lines I'm not disappointed to find out otherwise. I'm not angry to find out otherwise. I'm not trying to attack or offend anyone. I'm just telling you what I thought imagetools might do based on an optimistic outset, hope, and reading the docs. I was wrong. |
Beta Was this translation helpful? Give feedback.
-
Hi Jonas :-)
Still very new to your plugin, and I'm trying to understand it better...I am trying to use it in a Svelte-Kit app and I was assuming that it would change the html a little bit for me. But I think this assumption is incorrect?
For example, if I have an image tag:
...and I import an image and transform it using imagetools:
...I thought the html would change to something like this(pseudo code), adding in the
srcset
attribute for me:...or something like that...this does not seem to be the case, though?
Should I be handling adding the
srcset
myself?Where does
vite-imagetools
end and my code begin?No LQIP functionality at the moment? (Low Quality Image Placeholder)
Just trying to understand things better :-)
Beta Was this translation helpful? Give feedback.
All reactions