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

Input path goes inside Output path #562

Closed
EthraZa opened this issue Feb 8, 2023 · 5 comments
Closed

Input path goes inside Output path #562

EthraZa opened this issue Feb 8, 2023 · 5 comments

Comments

@EthraZa
Copy link

EthraZa commented Feb 8, 2023

1st run:
minify --sync --all --recursive --preserve=links,mode,ownership,timestamps --match '\.(css|html|js)$' dir/a/ -o dir/b/

dir/b will get created as expected.

2nd run:
minify --sync --all --recursive --preserve=links,mode,ownership,timestamps --match '\.(css|html|js)$' dir/a/ -o dir/b/

It will create dir/b/a with the content I would expect in dir/b.

It does not metter if I add "/" at the end of the paths or not.
If I use dir/a/* -o dir/b/, it will do it right but will ignore the recursive part and will not create/sync the sub directories.

Is it a bug or am I missing something?

@tdewolff
Copy link
Owner

tdewolff commented Feb 9, 2023 via email

@tdewolff
Copy link
Owner

I've run some tests, and this behaviour is the same as with cp -rv dir/a/ dir/b/. The first run will put the contents of dir/a into dir/b, but the second run will put the contents of dir/a directory into dir/b/a.

The / at the end of the path used to be a way to explicitly mean a directory, but this has been removed to be in line with cp and could in general be deduced automatically.

As to the final comment about using dir/a/*, I've added a subdirectory as dir/a/sub and ran minify -sro dir/b dir/a/* and indeed there is a problem that when dir/b doesn't exist, the contents of dir/a/sub appear in dir/b the first time, and in dir/b/sub the second time. It should be the latter always.

@tdewolff
Copy link
Owner

Fixed the last part by throwing an error that the directory doesn't exist, much like cp. Let me know what you think!

@EthraZa
Copy link
Author

EthraZa commented Jun 15, 2023

That worked like a charm. Thank you.

The only thing I have noticed but, at least for me, is not a big problem, is that at first run (minify --match '\.(css|html|js)$' --exclude "ext-all.js|ux.js" --sync --all --recursive --preserve=links,mode,ownership,timestamps a/* --output b/), the time of directories are not preserved, they get the actual run time - I guess it's because minify is mkdiring they when they does not exist yet.

@tdewolff
Copy link
Owner

tdewolff commented Jun 17, 2023

I've pushed an update to fix that, please try. Additionally, I've added support for -p=all which would shorten the command in your case.

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

No branches or pull requests

2 participants