Skip to content

Commit 044bd2a

Browse files
authored
Update README.md
1 parent 8654444 commit 044bd2a

File tree

1 file changed

+50
-7
lines changed

1 file changed

+50
-7
lines changed

README.md

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,26 @@ By default, your images will served via the [fetch delivery method](https://clou
4343

4444
### Plugin Inputs
4545

46-
| Name | Required | Description |
47-
|-----------------|----------|-------------|
48-
| cloudName | false* | Cloudinary Cloud Name |
49-
| deliveryType | false | The method in which Cloudinary stores and delivers images (Ex: fetch, upload) |
50-
| imagePath | false | Local path application serves image assets from |
51-
| folder | false | Folder all media will be stored in. Defaults to Netlify site name |
52-
| uploadPreset | false | Defined set of asset upload defaults in Cloudinary |
46+
| Name | Required | Example | Description |
47+
|-----------------|----------|-----------| ------------|
48+
| cloudName | No* | mycloud | Cloudinary Cloud Name |
49+
| deliveryType | No | fetch | The method in which Cloudinary stores and delivers images (Ex: fetch, upload) |
50+
| imagePath | No | /assets | Local path application serves image assets from |
51+
| folder | No | myfolder | Folder all media will be stored in. Defaults to Netlify site name |
52+
| uploadPreset | No | my-preset | Defined set of asset upload defaults in Cloudinary |
5353

5454
*Cloud Name must be set as an environment variable if not as an input
5555

56+
### Environment Variables
57+
58+
| Name | Required | Example | Description |
59+
|------------------------|----------|----------|-------------|
60+
| 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+
5666
### Setting your Cloud Name
5767

5868
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
156166
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.
157167

158168
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

Comments
 (0)