-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inline plugin: inline external images #573
Comments
You can use remote files for that: https://lume.land/docs/core/remote-files/ |
would it be possible to use any remote images as remote files? (e.g via regex or preprocess plugin) |
I guess you can create a processor to download remote images and convert them to pages. site.process([".html"], (pages, allPages) => {
for (const page of pages) {
const externalImages = page.document.querySelectorAll("img[src^='https://']");
for (const img of externalImages) {
const response = await fetch(img.getAttribute("src"));
const content = new Uint8Array(await response.arrayBuffer());
allPages.push(Page.create({
url: //generate filename using the image url
content,
});
}
}
}); |
does lume support some kind of 'async queue' to queue long tasks and await promise.all them later? |
You can use site.process([".html"], async (pages, allPages) => {
await Promise.all(pages.map((page) => ... ));
}); |
alright, ill take a look this weekends. |
Enter your suggestions in details:
in lume external images have significant downsides to local images due to not being able to use image plugins.
The text was updated successfully, but these errors were encountered: