
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
babel-plugin-cloudinary
Advanced tools
Compile cloudinary URLs at build time.
You can define the globals for your cloudinary URLs in a cloudinaryrc.json
that should be placed in the root of your project.
{
"native": {
"cloud_name": "trivago",
"secure": true
},
"overrideBaseUrl": true,
"host": "trivago.images.com"
}
cloudinary-core
upon instantiation, you can use
all the configs in the official cloudinary API.res.cloudinary.com/trivago/image/upload
).__buildCloudinaryUrl(assetName, options);
http[s]://host/<transforms>/<prefix><assetName><postfix><resourceExtension>
options
are entirely optional.{height: 250, width: 250}
).
For convince they will keep the same API as the cloudinary-core image transformations, these said you can check the official docs and use the cloudinary-core
API directly.assetName
.assetName
.assetName
, let's supose that your assetName
is dog-picture
you can
simple pass dog-picture.jpeg
within the assetName
itself. This optional parameter is only here you to give you a more robust API and also the possibility to interpolate the prefix
and postfix
with the assetName
as you can see in the url above URL structure <prefix><assetName><postfix><resourceExtension>
.npm install babel-plugin-cloudinary
{
"plugins": ["babel-plugin-cloudinary"]
}
// gallery.js
function getImageUrl(imageName) {
// compiles into "`${'https://res.cloudinary.com/<cloud_name>/image/upload/'}${imageName}${'.jpeg'}`;"
return __buildCloudinaryUrl(imageName, {
transforms: {
width: 250,
height: 250,
},
resourceExtension: ".jpeg",
});
}
This projects ships together with the plugin a types definition file (index.d.ts
) that will
be automatically recognized by IDEs and text editors with typescript based IntelliSense. In case you have some linting in place it might also be convenient to make __buildCloudinaryUrl
a global. With eslint you can achieve this by adding a simple property to the globals
block just like:
// .eslintrc.js
module.exports = {
// ...
globals: {
// ...
__buildCloudinaryUrl: true,
},
// ...
};
__buildCloudinaryUrl
and cloudinaryrc.json
.FAQs
Compile cloudinary URLs at build time
The npm package babel-plugin-cloudinary receives a total of 1 weekly downloads. As such, babel-plugin-cloudinary popularity was classified as not popular.
We found that babel-plugin-cloudinary demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.