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
Use case: A site that holds many images that are render by a component.
The component just use a simple img tag with src={src}
Question: Is it possible to crawl all the instances of this img tag to get the src attribute, optimize that and replace it with a new value? (And even add new attributes to the element).
What I tried:
I created an svelte-preprocess transformer that accomplish exactly this but not for dynamic sources.
It take all the img tags and get the source correctly.
I also tried to build a Vite plugin but I can't figure it out how to hook into the pre-render output.
What I intend is very similar to a gastby site/plugin that let's you get the entire site content and perform some transformations (since is static)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Use case: A site that holds many images that are render by a component.
The component just use a simple img tag with
src={src}
Question: Is it possible to crawl all the instances of this img tag to get the src attribute, optimize that and replace it with a new value? (And even add new attributes to the element).
What I tried:
I created an svelte-preprocess transformer that accomplish exactly this but not for dynamic sources.
It take all the img tags and get the source correctly.
I also tried to build a Vite plugin but I can't figure it out how to hook into the pre-render output.
What I intend is very similar to a gastby site/plugin that let's you get the entire site content and perform some transformations (since is static)
Beta Was this translation helpful? Give feedback.
All reactions