Copy images in markdown without processing them. Can be used in combination with gatsby-remark-images
to copy SVG and GIF files. Make sure to place this plugin after gatsby-remark-images
.
yarn add --dev gatsby-remark-static-images
// gatsby-config.js
plugins: [
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
'gatsby-remark-static-images'
]
}
}
]
By default files are saved to public/static and named ${fileNode.name}-${fileNode.internal.contentDigest}.${fileNode.extension}
. This can be overridden like so:
// gatsby-config.js
plugins: [
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
'gatsby-remark-static-images',
generateImageName: (fileNode) => {
return `${fileNode.internal.contentDigest}/${fileNode.name}.${fileNode.extension}`
}
]
}
}
]