npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

metalsmith-cloudinary

v0.2.0

Published

A metalsmith plugin for retrieving data from the cloudinary api.

Downloads

7

Readme

metalsmith-cloudinary

npm version dependency status devdependency status downloads

A metalsmith plugin for retrieving data from the Cloudinary api

stack overflow slack chat

Cloudinary is a CDN that allows you to upload images and apply transformations when retrieving them. This is immensely useful when working with responsive images, because now you no longer have to process images during your build process.

Just add parameters to your images' url, and Cloudinary will supply the image at the correct dimensions via their CDN. I recommend cloudinate to automate the uploading of your images to Cloudinary. That being said, Cloudinary accepts all kinds of files, so this plugin and cloudinate can of course be used for all kinds of other purposes as well.

For support questions please use stack overflow or our slack channel. For questions about Cloudinary try the aforementioned channels, as well as their documentation. Specifically the list resources part of the admin api, which is what this plugin provides access to.

Installation

$ npm install metalsmith-cloudinary

Example

Configuration in metalsmith.json:

{
  "plugins": {
    "metalsmith-cloudinary": {
      "cloud_name": "your_cloud_name_here",
      "api_key": "your_api_key_here",
      "api_secret": "your_api_secret_here",
    }
  }
}

metalsmith-cloudinary will query the Cloudinary api and store the results in the global metadata under cloudinary, indexed by your assets' public_id. The contents will of course differ depending on what you've uploaded, but will resemble:

// images/1 is the public_id
'images/1': {
  "format": "jpg",
  "version": 1333013579,
  "resource_type": "image",
  "type": "upload",
  "created_at": "2012-03-29T09:32:59Z",
  "bytes": 128891,
  "width": 283,
  "height": 424,
  "url": "http://res.cloudinary.com/demo/image/upload/v1333013579/1.jpg",
  "secure_url": "https://res.cloudinary.com/demo/image/upload/v1333013579/1.jpg"
},
// images/2 is the public_id
'images/2': {
  "format": "jpg",
  "version": 1333013579,
  "resource_type": "image",
  "type": "upload",
  "created_at": "2012-03-29T09:32:59Z",
  "bytes": 128891,
  "width": 283,
  "height": 424,
  "url": "http://res.cloudinary.com/demo/image/upload/v1333013579/2.jpg",
  "secure_url": "https://res.cloudinary.com/demo/image/upload/v1333013579/2.jpg"
},

Which means that in your templates you could use (with something like swig and metalsmith-in-place):

{{ cloudinary['images/1'].secure_url }}
{{! would be rendered to: https://res.cloudinary.com/demo/image/upload/v1333013579/1.jpg }}

Options

You can pass options to metalsmith-cloudinary with the Javascript API or CLI. The options are:

  • cloud_name: your cloud name (required)
  • api_key: your api key (required)
  • api_secret: your api secret (required)
  • params: an optional object of parameters to pass to the cloudinary api (optional)
  • ttl: ms to retain cache, false to disable cache, default: (60 * 60 * 1000) / 500 (optional)

credentials

Your Cloudinary API credentials. So this metalsmith.json:

{
  "plugins": {
    "metalsmith-cloudinary": {
      "cloud_name": "your_cloud_name_here",
      "api_key": "your_api_key_here",
      "api_secret": "your_api_secret_here",
    }
  }
}

Would retrieve all files you've uploaded to Cloudinary and store them in your metadata.

params

An object of optional parameters to pass to the Cloudinary API. By default the max_results option is set to the maximum (500). So this metalsmith.json:

{
  "plugins": {
    "metalsmith-cloudinary": {
      "cloud_name": "your_cloud_name_here",
      "api_key": "your_api_key_here",
      "api_secret": "your_api_secret_here",
      "params": {
        "max_results": 10
      }
    }
  }
}

Would retrieve 10 results at maximum and store them in your metadata.

build & test

npm run babel:node6 to build npm run test or npm run test:watch for tests, no global dependencies required

License

MIT