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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hint/hint-image-optimization-cloudinary

v3.2.27

Published

hint that that checks using Cloudinary's API if images are optimized

Downloads

103,841

Readme

Optimize images (image-optimization-cloudinary)

image-optimization-cloudinary uses the Cloudinary service to analyze your images and see if there could be size savings on them.

Note: To use this hint you will need to have an account in this service and configure it to use those credentials via the CLOUDINARY_URL environment variable or in the hint’s configuration. You can create a free account here.

Why is this important?

As of June 1st, 2019, and based on HTTP Archive, images account for a bit over 47% of the size of a website in average.

"Average Bytes per Page by Content Type"

By having your images optimized, you will help your users have a better and faster experience when navigating in your website.

What does the hint check?

This hint will use Cloudinary’s infrastructure to upload any images found and check if they can be optimized maintaining the same resolution and format.

Can the hint be configured?

Yes, if you don’t want to use the CLOUDINARY_URL environment variable to set up your credentials, you can pass them to the hint via the hint configuration from the .hintrc file:

{
    "connector": {...},
    "formatters": [...],
    "hints": {
        "image-optimization-cloudinary": ["error", {
            "apiKey": "your api key",
            "apiSecret": "your api secret",
            "cloudName": "your cloud name"
        }],
        ...
    },
    ...
}

By default, this hint will notify you even if there is a 1kB savings. If you want to change the threshold you can do it by having something as the following in the .hintrc file:

{
    "connector": {...},
    "formatters": [...],
    "hints": {
        "image-optimization-cloudinary": ["error", {
            "threshold": 10
        }],
        ...
    },
    ...
}

The threshold value will be used for the savings per image, and the total possible savings.

Examples that trigger the hint

  • Having an image that Cloudinary can optimize further.
  • Having a threshold configured and an image whose savings is equal or greater than the configured value.
  • Having a threshold configured and several images whose individual savings is less than threshold but when combined it’s greater. For example, if you configure a threshold of 10, and you have one image that could be 6kB smaller, and another one that could be 5kB smaller, this hint will report an issue because the combined savings is greater than 10.

Examples that pass the hint

  • Having all your images optimized.
  • Having a threshold configured and the combined savings of all images smaller to that value.

How to use this hint?

This package is installed automatically by webhint:

npm install hint --save-dev

To use it, activate it via the .hintrc configuration file:

{
    "connector": {...},
    "formatters": [...],
    "hints": {
        "image-optimization-cloudinary": "error",
        ...
    },
    "parsers": [...],
    ...
}

Note: The recommended way of running webhint is as a devDependency of your project.

Further Reading