Skip to content
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

Move images and downloads directories to root #82

Merged
merged 2 commits into from
Dec 18, 2024
Merged

Conversation

lochhh
Copy link
Collaborator

@lochhh lochhh commented Dec 2, 2024

This PR closes #81.

This PR

  • renames the src/_static/images directory and its contents to src/images
  • updates all occurrences of _static/images in the doc pages to images
  • renames the src/_static/resources directory and its contents to src/downloads
  • updates all occurrences of _static/resources in the doc pages to downloads

@lochhh lochhh requested a review from glopesdev December 2, 2024 12:29
@lochhh lochhh marked this pull request as ready for review December 2, 2024 12:31
Copy link
Collaborator

@glopesdev glopesdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lochhh looking at examples online and in Sphinx's own docs it seems that the recommendation is to use local image paths without the leading _, i.e. using src/images instead of src/_images.

I'm guessing that _ might be more recommended for sphinx infrastructure reserved paths.

@lochhh
Copy link
Collaborator Author

lochhh commented Dec 13, 2024

@lochhh looking at examples online and in Sphinx's own docs it seems that the recommendation is to use local image paths without the leading _, i.e. using src/images instead of src/_images.

I'm guessing that _ might be more recommended for sphinx infrastructure reserved paths.

Thanks @glopesdev. The issue (#81) is that Sphinx copies all images (regardless of where they are) into the _images dir, so we end up with duplicate copies of the images (one in the original dir and another in _images). If we drop the leading _, we will end up with duplicate copies of the images again.

@glopesdev
Copy link
Collaborator

glopesdev commented Dec 18, 2024

The issue (#81) is that Sphinx copies all images (regardless of where they are) into the _images dir, so we end up with duplicate copies of the images (one in the original dir and another in _images).

@lochhh Are you sure the images are being copied from the original dir? Don't forget to clean/delete the html folder to make sure no leftover files are there. Files outside of _static are not usually copied unless they are part of a processing pipeline.

For images, that pipeline involves the assets being referenced in the articles, and each image will be copied to _images with their URL rewritten in the final output. As long as the image source folder is outside of _static they should not be duplicated. I did a quick test which seems to verify this, but I am curious if you are observing something else.

@lochhh lochhh changed the title Move images directory to root Move images and downloads directories to root Dec 18, 2024
@lochhh
Copy link
Collaborator Author

lochhh commented Dec 18, 2024

The issue (#81) is that Sphinx copies all images (regardless of where they are) into the _images dir, so we end up with duplicate copies of the images (one in the original dir and another in _images).

@lochhh Are you sure the images are being copied from the original dir? Don't forget to clean/delete the html folder to make sure no leftover files are there. Files outside of _static are not usually copied unless they are part of a processing pipeline.

For images, that pipeline involves the assets being referenced in the articles, and each image will be copied to _images with their URL rewritten in the final output. As long as the image source folder is outside of _static they should not be duplicated. I did a quick test which seems to verify this, but I am curious if you are observing something else.

Thanks @glopesdev you're right. I've now removed the _ and made the same change for the downloadable files (BOM, wiring diagrams, building instructions).

@glopesdev glopesdev self-requested a review December 18, 2024 13:30
@lochhh lochhh merged commit 14e7dec into main Dec 18, 2024
2 checks passed
@lochhh lochhh deleted the move-image-dir branch December 18, 2024 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider moving all images to top-level folder outside of _static
2 participants