Skip to content

Commit

Permalink
Add configuration option to skip image processing
Browse files Browse the repository at this point in the history
In some cases, developers may want to skip image processing entirely. This may be useful for a site that is using an image CDN such as cloudinary: the cdn provides transformations, so we don't need to use Gatsby's transformation layer.
  • Loading branch information
tylerpaige committed Apr 26, 2022
1 parent 48fa72d commit 02ce064
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,19 @@ To query your asset use the following query:
}
```

If you do not want this plugin to download your media (images, videos, and file attachments), you can use the `skipMediaProcessing` configuration option


**Path:** `./gatsby.config.js`

```javascript
const strapiConfig = {
// ...
skipMediaProcessing: true
// ...
};
```

#### Rich text field

Rich text fields can now be processed using the [`gatsby-transformer-remark`](https://www.gatsbyjs.com/plugins/gatsby-transformer-remark/https://www.gatsbyjs.com/plugins/gatsby-transformer-remark/) plugin.
Expand Down
4 changes: 3 additions & 1 deletion src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ exports.sourceNodes = async (
for (let i = 0; i < endpoints.length; i++) {
const { uid } = endpoints[i];

await downloadMediaFiles(data[i], ctx, uid);
if (!strapiConfig.skipMediaProcessing) {
await downloadMediaFiles(data[i], ctx, uid);
}

for (let entity of data[i]) {
const nodes = createNodes(entity, ctx, uid);
Expand Down

0 comments on commit 02ce064

Please sign in to comment.