Thanks to visit codestin.com
Credit goes to github.com

Skip to content

When using --output have option to preserve directory structure #8

@pbowyer

Description

@pbowyer

Thanks for writing this script!

When using

npx avif --input="/path/to/www/assets/**/*.*" --output=/path/to/www/assets-avif --verbose

It would be really nice if there was a built-in way to preserve the input directory structure in the output directory.

We don't want to save the AVIFs to the same folder as the source images as the CMS media browser will show both, but for easy try_files configuration we'd like to mirror the directory structure in the destination. Plus it keeps the folders with a manageable number of images in them.

Example:

/path/to/www/assets/images/foo/bar/baz.jpg => /path/to/www/assets-avif/images/foo/bar/baz.avif

(Having an option to append .avif would also be cool, to mirror how our bash script has been doing it. So the output file name is baz.jpg.avif. That way the try_files usage stays simple.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions