Closed karlhorky closed 3 years ago
Hi @akabekobeko ! 👋
In order to achieve good long-term caching of files, it is good if the filenames change if the contents change.
To do this, very often an md5 digest is generated of the file and then included in the filename (see how gatsby-remark-copy-linked-files does it)
gatsby-remark-copy-linked-files
Would you be open to accepting a new option called filename that would have access to this hash, in case a user would like to prepend the hash:
filename
// In your `gatsby-config.js` plugins: [ { resolve: 'gatsby-transformer-remark', options: { plugins: [ { resolve: 'gatsby-remark-copy-relative-linked-files', options: { // would generate file-1abcb33beeb811dca15f0ac3e47b88d9.pdf filename: ({hash, name, extension}) => `${name}-${hash}.${extension}` }, }, ], }, }, ]
May be able to use the existing linkNode.internal.contentDigest property from Gatsby (as gatsby-remark-copy-linked-files also does).
linkNode.internal.contentDigest
One more question: how do you feel about changing the default to append this hash on the end?
Hi @akabekobeko ! 👋
In order to achieve good long-term caching of files, it is good if the filenames change if the contents change.
To do this, very often an md5 digest is generated of the file and then included in the filename (see how
gatsby-remark-copy-linked-files
does it)Would you be open to accepting a new option called
filename
that would have access to this hash, in case a user would like to prepend the hash:May be able to use the existing
linkNode.internal.contentDigest
property from Gatsby (asgatsby-remark-copy-linked-files
also does).One more question: how do you feel about changing the default to append this hash on the end?