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

Clear output folder on eleventy.build event #74

Merged
merged 5 commits into from
Feb 23, 2023

Conversation

tylermercer
Copy link
Contributor

This adds an emptyOutputOnRebuild flag that would clear the OG image directory when Eleventy rebuilds. I haven't had a chance to test this yet--gonna do that tonight.

If you want, I can change this to default to true.

It'd be nice to make this default to true but I need to look at the rest of the code to see what that entails
@tylermercer
Copy link
Contributor Author

The rmDir implementation was adapted from here

@KiwiKilian
Copy link
Owner

KiwiKilian commented Feb 22, 2023

First of all, thank you for your contribution!

Can you elaborate a bit what's the use case, why is this behavior desirable? Cleanup during development, because there are always new files when changing anything in the template? Or more preventing to deploy old/not anymore used og images?

@tylermercer
Copy link
Contributor Author

Both, but mostly the first. I have found myself opening the OG folder in my editor to see how it looks, and having to either delete the old ones and trigger a fresh rebuild or just click through all the images to find the new ones has been really inconvenient.

Thank you for this awesome plugin, by the way! It's so nice.

@KiwiKilian
Copy link
Owner

Yeah, development process is currently quite a mess 😅. Curious if there would be even better alternatives than cleaning the directory. I will look into it later.

@tylermercer
Copy link
Contributor Author

There may be. I'm fine even if this is rejected--I realized I can put this same logic directly into my site's config, so I did that and it works great. 😅 But, to me, not keeping both old and new images does seem like the ideal behavior for the plugin.

@tylermercer
Copy link
Contributor Author

(Also, apologies for not linting my code before submitting the PR 🙈 )

tylermercer added a commit to tylermercer/personal-website that referenced this pull request Feb 22, 2023
.eleventy.js Outdated Show resolved Hide resolved
.eleventy.js Outdated Show resolved Hide resolved
@KiwiKilian KiwiKilian added the enhancement New feature or request label Feb 22, 2023
tylermercer and others added 2 commits February 22, 2023 14:29
Suggestion from @KiwiKilian

Co-authored-by: Kilian Finger <hey@kilianfinger.com>
Co-authored-by: Kilian Finger <hey@kilianfinger.com>
@tylermercer tylermercer changed the title Add emptyOutputOnRebuild flag Clear output folder on eleventy.build event Feb 22, 2023
@KiwiKilian KiwiKilian merged commit 87a5dd6 into KiwiKilian:main Feb 23, 2023
@tylermercer tylermercer deleted the patch-1 branch February 23, 2023 05:25
github-actions bot pushed a commit that referenced this pull request Feb 23, 2023
# [1.6.0](v1.5.0...v1.6.0) (2023-02-23)

### Features

* clear outputDir on eleventy.build event ([#74](#74)) ([3e60531](3e60531))
@KiwiKilian
Copy link
Owner

Had to apply some force to change the commit message after GitHub mobile didn't ask me how the merge commit should be name 🙈 – anyways it's released now! Thanks for your help 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants