Skip to content

cloudinary/js-url-gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome

About this project

This project enables you to create Cloudinary URLs for your images. Using this SDK, you can apply advanced transformations to your images.

What is this project for?

This project comes to replace and modernize our existing JS offering, and it's part of a larger effort in Cloudinary.

You can read more about the project here:

Key Features

  • ESM packages, import only what you need
  • Declarative Syntax
  • Fully typed for excellent IDE support
  • Easy to write, easy to read.

Installation

npm install @cloudinary/base 

Transpilation

@cloudinary/base is optimized around bundle size, as such we do not transpile our distributed modules, we leave the decision of what browsers to support, and what transpilations to apply, to you, the user.

Testing with Jest

As mentioned above, we're shipping @cloudinary/base with ES6 code, as this provides great tree-shaking potential. it also requires a few adjustments when testing.

In jest.config, you'll need to add these lines to allow babel to transpile our code.

{
  "transform": {
    "node_modules/@cloudinary/base": "babel-jest"
  },
  "transformIgnorePatterns": ["/node_modules/(?!@cloudinary/base)"]
}

Make sure to install babel-jest: npm install babel-jest

You'll also need to ensure you have a babel.config.js file (and not a .babelrc), and that it's configured properly to transpile code,

As an example:

module.exports = {
  "presets": [
    "@babel/preset-env"
  ]
};

Interested in Cloudinary?

Feel free to visit our more mature SDKs: