You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/gatsby-transformer-sharp/README.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,28 @@ It recognizes files with the following extensions as images.
38
38
39
39
Each image file is parsed into a node of type `ImageSharp`.
40
40
41
+
## Configuration options
42
+
43
+
`checkSupportedExtensions`[boolean][optional]
44
+
45
+
Sharp only supports certain image formats (see the Parsing algorithm section above) and hence throws a warning when you e.g. use a .gif in an `ImageSharp` query. You'll need to use `publicURL` instead. With this option you can disable the warning behavior.
46
+
47
+
```javascript
48
+
// In your gatsby-config.js
49
+
module.exports= {
50
+
plugins: [
51
+
`gatsby-plugin-sharp`,
52
+
{
53
+
resolve:`gatsby-transformer-sharp`,
54
+
options: {
55
+
// The option defaults to true
56
+
checkSupportedExtensions:false,
57
+
},
58
+
},
59
+
],
60
+
}
61
+
```
62
+
41
63
## Troubleshooting
42
64
43
65
### Incompatible library version: sharp.node requires version X or later, but Z provides version Y
// TODO: In future when components from GraphQL are possible make sure that we can support both supported & unsupported image formats
11
+
if(
12
+
!supportedExtensions[parent.extension]&&
13
+
checkSupportedExtensions
14
+
){
9
15
reporter.warn(
10
16
`You can't use childImageSharp together with ${parent.name}.${parent.extension} — use publicURL instead. The childImageSharp portion of the query in this file will return null:\n${context.componentPath}`
0 commit comments