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

Support directories as params, format with black, and add type hints #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

devtud
Copy link

@devtud devtud commented Jul 18, 2022

No description provided.

for subdir in source_dir.glob("**/"): # first subdir is the dir itself
if subdir == source_dir:
continue
discover_and_convert(subdir, target_dir / subdir.name)
Copy link
Owner

Choose a reason for hiding this comment

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

Why the recursion and not just use source.dir.glob("**/*.woff") in the first place?

Copy link
Author

Choose a reason for hiding this comment

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

Your question makes a lot of sense.
The only reason I opted for recursion is because I could keep the same directory structure in the output directory with no effort.

If the source directory looks like:

input_dir
    subdir1
        subdir11
            subdir111
                font.woff

With your approach and with no effort, the output dir would look like:

output_dir
    font.otf

If you have a clean way of keeping the subdir structure, I'd happily apply it.

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.

2 participants