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

feat: support for template directories #6

Merged
merged 2 commits into from
May 7, 2024
Merged

Conversation

juliamertz
Copy link
Member

I'm not sure if this is something you're interested in, but i ran into this problem a few times so i though it would be easier to add support for template directories instead of writing a shell script for this every time.

I wasn't quite sure how to do naming for the output directories, for now i just used the variant name.
Let me know if there are any changes that I need to make

@mvllow
Copy link
Member

mvllow commented May 6, 2024

Thank you for the quality PR! After a quick glance I don't fully understand the problem you were facing—could you give an example of how things were done before the PR and how it's simpler/improved after :)

@juliamertz
Copy link
Member Author

Ah sorry i should have been more clear, When working on a port for rose pine i often have multiple files which need the colors. currently the build tool only supports one template file at a time, when passing the path to a directory as the --template flag it will crash trying to read the directory. Error: EISDIR: illegal operation on a directory, read

To fix this i pulled out the main logic from the generateVariants function and added a check to see if the passed in template path is a directory, if not it will take the same path as before and everything remains unchanged.

When a directory is passed in it'll create output directories for each variant and generate the result for all template files contained in that directory. The output filenames will remain unchanged from the input files in this case.

fixed small mistake, added test case for this as well
@mvllow mvllow merged commit 1717828 into rose-pine:main May 7, 2024
1 check failed
@mvllow
Copy link
Member

mvllow commented May 7, 2024

Thanks again!

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