maybe something is missing from the docs, or maybe I'm stupid but I can't see how to get images to work.
I setup a simple site with an /img directory.
Images don't appear when serving the site or get copied to _site
searched for "images" on https://www.11ty.io/docs but can't find much. images
I _did_ find a couple of closed issues and so I tried the passThrough config:
https://www.11ty.io/docs/copy/
I tried both as templateFormats and passThrough files, neither works:
file : .eleventy.js
module.exports = function(eleventyConfig) {
// Copy the `img/` directory
eleventyConfig.addPassthroughCopy("img");
return {
passthroughFileCopy: true
};
};
However it doesn't seem to actual copy the /img directory.
build output (naming the config to make sure it is finding it)
eleventy --config=.eleventy.js
Writing _site/README/index.html from ./README.md.
Processed 1 file in 0.18 seconds
The only thing I found to work is to put the images into _site directly.
Is this the recommended process? It seems if there was a build --clean then everything would get wiped out. I would also prefer to .gitignore the file site output.
It seems adding images to a site is the first thing people would do, so it would be nice if this was a little easier or at least clearer.
eleventy --version
0.8.1
https://github.com/11ty/eleventy/issues/379
https://github.com/11ty/eleventy/issues/178#issuecomment-406687951
so it should work as above... hmm.
update: works. somehow my .eleventy.js managed to get an invisible character at the end of the filename...
however it might still be worth making this more obvious on the docs (or a default images directory?) so new users don't have to hunt down pass through just to serve a static image.
Most helpful comment
however it might still be worth making this more obvious on the docs (or a default images directory?) so new users don't have to hunt down pass through just to serve a static image.