-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Cannot copy one file to multiple destinations #428
Comments
Site.copy previously didn't support multiple destinations: site.copy("foo", "bar1") site.copy("foo", "bar2") Previously resulted in `foo` being only copied once to `bar2`. site.copy("static") site.copy("static/foo", "bar") Previously didn't copy `static/foo` to `bar`. This commit fixes both of these bugs. Fixes lumeland#428.
Site.copy previously didn't support multiple destinations: site.copy("foo", "bar1") site.copy("foo", "bar2") Previously resulted in `foo` being only copied once to `bar2`. site.copy("static") site.copy("static/foo", "bar") Previously didn't copy `static/foo` to `bar`. This commit fixes both of these bugs. Fixes lumeland#428.
Ok, I just saw your pull request (many thanks!) but I'd like to continue the conversation here about how is supposed to work and leave the PR for implementation details. Is there any real use case in which you want to duplicate a file and save it in multiple destinations? The most common use case is:
What you're proposing is the destination directory had the favicons in two different places: Lume doesn't handle this well, because once the It's perfectly valid that the same file matches different For example, I want to copy all site.copy([".jpg"]); But I want to copy a specific jpg file to a specific destination: site.copy("/cover/image.jpg", "/img/cover/image.jpg"); The second condition is more specific than the first, so the image should be copied once to To me, the priority is the following (ordered from less specific to most specific):
|
You could use Lume to generate multiple sites. I agree that the "copy by extension" mechanism should have a lower priority than the "copy a specific path" mechanism. However I seriously don't think that we should do anything fancy about the "copy a specific path" mechanism because it breaks user expectations. When it comes to an API the code should do what the code says literally. If a method is called site.setImplicitCopyDecider(
(path: string, ext: string) => [".jpg", ".gif", ".png"].includes(ext),
); This also makes it much easier to explain the behavior to the user: With the |
I don't get this. You cannot build multiple sites from a single
|
The
Site.copy
API is currently quite the footgun:You cannot copy one file to multiple locations.
foo
is only copied tobar2
.You cannot copy a directory and one file in the directory elsewhere.
static/foo
is not copied tobar
.I would consider both of these to be bugs.
The text was updated successfully, but these errors were encountered: