-
-
Notifications
You must be signed in to change notification settings - Fork 495
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
Automatic passthrough copy for files referenced in HTML output files #3552
Comments
People might intentionally put currently invalid references in their source files (e.g. |
Ah, to be clear this would be an opt-in feature via a configuration API flag for now to avoid conflicts with existing projects. The HTML transformer runs as a postprocessing step currently! It’s used by the Base plugin, the InputPath to URL plugin, the Image transform, among others. |
Yes please! Currently, I’m working around it with the following passthrough config: config.addPassthroughCopy('src/articles/**/*.!(md|yml)') And just to clarify: will it work if the resource is referenced in Markdown? |
@pepelsbey yes, absolutely! |
I wonder what would happen if I have some references in my HTML that I do want but also have some assets that I do some sort of processing on the side, or generated from other npm scripts. I think this could benefit some obvious parts (like favicons for example), but mess up others. I wonder how I could signal inline if I want to opt-out, because if the user needs to exclude paths, then I don't see the benefit from just configuring the passthroughs you want 🤔 |
What if someone stores image assets in |
Glad to hear this scenario will be accounted for — that's exactly how I structure things with quite a bit of my content; I actually use a dummy protocol on the URLs, replacing it with one value on dev but pointing it to an S3 bucket once it's deployed. |
PR for the AutoCopy plugin (with a few preliminary docs) is here: #3573 Feedback welcome! |
#3573 is shipping with the Html Relative feature for Passthrough File Copy in v3.0.1-alpha.1 |
Use the existing HTML transformer architecture and wire it up to passthrough file copy to move any references to assets on the local file system to the output folder automatically.
For example:
<img src="my-image.png" alt="">
intemplate.html
copies to_site/template/my-image.png
<img src="my-image.png" alt="">
insubdir/template.html
copies to_site/subdir/template/my-image.png
<img src="deeper/my-image.png" alt="">
insubdir/template.html
copies to_site/subdir/template/deeper/my-image.png
These output references would be relative to the template’s
outputPath
/permalink
. This would apply to any URLs processed by https://github.com/11ty/eleventy-posthtml-urls.Related:
@11ty/import
fetchAsset method: https://github.com/11ty/eleventy-import/blob/806ec4c67dd5782e9406d35c211ab1ad50ff26b6/src/Fetcher.js#L148-L213The text was updated successfully, but these errors were encountered: