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
| CLOUDINARY_CLOUD_NAME | No*| mycloud | Cloudinary Cloud Name |
61
+
| CLOUDINARY_API_KEY | No | 1234 | Cloudinary API Key |
62
+
| CLOUDINARY_API_SECRET | No | abcd1234 | Cloudinary API Secret |
63
+
64
+
*Cloud Name must be set as an input variable if not as an environment variable
65
+
56
66
### Setting your Cloud Name
57
67
58
68
You have two options for setting your Cloud Name: plugin input or environment variable.
@@ -156,3 +166,36 @@ While this works great for a lot of cases and in particular the first load of th
156
166
To provide comprehensive coverage of images being served from Cloudinary, we take advantage of Netlify's dynamic redirects and serverless functions to map any image being served from the /images directory (or the configured `imagesPath`), redirect it to a serverless function, which then gets redirected to a Cloudinary URL.
157
167
158
168
Through this process, we're still able to afford the same option of using either the fetch or upload API depending on preference, where the latter would be uploaded if it's a new asset within the serverless function.
169
+
170
+
## Development
171
+
172
+
### Plugin
173
+
174
+
To actively develop with the plugin, you need to be able to run a Netlify build and deploy.
175
+
176
+
You can do this by pushing a site that uses this plugin to Netlify or you can use the [Netlify CLI](https://docs.netlify.com/cli/get-started/) locally (recommended).
177
+
178
+
You can reference the plugin locally in your `netlify.toml` by specifying the directory the plugin is in relative to your project, for example:
179
+
```
180
+
[[plugins]]
181
+
package = "../netlify-plugin-cloudinary"
182
+
```
183
+
184
+
On the locally linked Netlify project, you can then run:
185
+
186
+
```
187
+
netlify deploy --build
188
+
```
189
+
190
+
Which will combine the build and deploy contexts and run through the full process, generating a preview URL.
191
+
192
+
#### Caveats
193
+
* The Netlify CLI doesn't support all input and environment variables for build plugins, primarily `process.env.DEPLOY_PRIME_URL` meaning the `onPostBuild` image replacement will not occur locally.
194
+
195
+
### Demo
196
+
197
+
The repository additionally includes a demo which uses the plugin. The demo is a simple Next.js application that lows a few images statically and those same images in a separate list once the page loads. This helps us test both the on-page image replacement and the redirecting of the images directory.
198
+
199
+
### Tests
200
+
201
+
Tests require all environment variables to be actively set in order to pass. See [configuration](#-configuration) above to see which variables need to be set.
0 commit comments