-
Notifications
You must be signed in to change notification settings - Fork 31
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
Download images alongside site files #16
base: main
Are you sure you want to change the base?
Conversation
@@ -58,7 +58,7 @@ | |||
|
|||
async function download_site() { | |||
loading = true | |||
const files = await build_site_bundle({ pages: $pages, symbols: $symbols }) | |||
const files = await build_site_bundle({ pages: $pages, symbols: $symbols }, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean it will always download the assets? A checkbox next to the download button would allow both options, with or without images.
|
||
const updated_content = _.mapValues(content, (lang_value) => | ||
_.mapValues(lang_value, (field_value) => { | ||
if (typeof field_value === 'object' && field_value.hasOwnProperty('alt')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should check that field_value.url is not empty, i was getting errors when downloading the site
// Download images | ||
const image_files = [] | ||
await Promise.all( | ||
files_to_fetch.map(async ({ url, filename }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be in a try catch since fetch can try to download forbidden assets, i have stumbled with this because i have some content with bad remote urls that can not be downloaded because of cors
Not ready to merge yet - right now it downloads images in the page sections and swaps out their URLs with the relative image url.
To do
Nice to have