gatsby-plugin-sharp
/ gatsby-remark-images
: Set destination directory with destinationDir option
#32739
Replies: 17 comments
-
This makes a lot of sense. Happy to receive a PR adding this! |
Beta Was this translation helpful? Give feedback.
-
Nice! Could you weigh in on where the changes should be made? In |
Beta Was this translation helpful? Give feedback.
-
@karlhorky could you tell us more about tooling that would be beneficial here? I feel that adding an option Users can easily set it to |
Beta Was this translation helpful? Give feedback.
-
@wardpeet in lieu of an Asset Manifest (see #20745), I would like the built assets to better match the inputs - eg. that output images be under the same paths as the input images:
This is in order to achieve server-side authentication and access control to the built assets - eg. #1100 (comment)
This is a good point, and maybe also something that should be applied to the Maybe one way of doing this would be to require and validate that the content hash be used somewhere in the filename? We could do this by running the function and making sure that the argument is being used, à la: But instead of validating that EITHER the |
Beta Was this translation helpful? Give feedback.
-
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Beta Was this translation helpful? Give feedback.
-
not stale |
Beta Was this translation helpful? Give feedback.
-
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Beta Was this translation helpful? Give feedback.
-
not stale |
Beta Was this translation helpful? Give feedback.
-
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Beta Was this translation helpful? Give feedback.
-
lol such a stale bot not stale |
Beta Was this translation helpful? Give feedback.
-
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Beta Was this translation helpful? Give feedback.
-
That's interesting, I'm still hesitant to enable this behavior as I don't fully understand the complications that this will bring. Technically we could start with adding outputDir to Would it help if you got a list of assets per route? |
Beta Was this translation helpful? Give feedback.
-
Well, as long as the Original Path
Before
After (without Here the first The name Config:
After (with Config:
|
Beta Was this translation helpful? Give feedback.
-
Sure, that would solve it a different way. That would be my request over at #20745 |
Beta Was this translation helpful? Give feedback.
-
I feel there are more use-cases for a manifest file than there might be for renaming files. This would indicate that these files are part of a route, so part of webpack or page-data |
Beta Was this translation helpful? Give feedback.
-
Yeah definitely, I think there are some use cases for sure for a full asset manifest. Right now I'm using the information in Back then I made a list of all the things that I found missing from |
Beta Was this translation helpful? Give feedback.
-
The project that I'm using it in is this |
Beta Was this translation helpful? Give feedback.
-
Summary
For the plugins
gatsby-plugin-sharp
and/orgatsby-remark-images
(whichever makes sense and is necessary), an optiondestinationDir
(string or function) that works similarly to the option ingatsby-remark-copy-linked-files
......also with the new
relativeDirectory
property in the returned file object:Basic example
See examples above.
Motivation
The structure of the files in the output
public
folder is more configurable and using therelativeDirectory
option, can also match 1 to 1 the folder structure of the inputsrc/pages
directory. This makes the output easier to reason about and also easier to build tooling upon.Beta Was this translation helpful? Give feedback.
All reactions