Socket
Socket
Sign inDemoInstall

remark-cloudinary-docusaurus

Package Overview
Dependencies
4
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    remark-cloudinary-docusaurus

Cloudinary offers an image CDN which can improve performance of your site. This plugin allows Docusaurus to use Cloudinary to serve optimised images.


Version published
Weekly downloads
2
Maintainers
1
Install size
17.2 kB
Created
Weekly downloads
 

Changelog

Source

1.2.0 (2023-01-13)

Features

  • use f_auto,q_auto (#5) (6aa6492)

Readme

Source

Remark Cloudinary Docusaurus plugin

Cloudinary offers an image CDN which can improve performance of your site. This plugin allows Docusaurus to use Cloudinary to serve optimised images.

remark-cloudinary-docusaurus version on npm Downloads on npm Build Contributor Covenant License: MIT Sponsor: On GitHub Style: Prettier TypeScript: Strict

Usage

npm i remark-cloudinary-docusaurus

We need to reference it in our docusaurus.config.js file. We do this by adding it to the rehypePlugins array:

//@ts-check
const remarkCloudinaryDocusaurus = require("remark-cloudinary-docusaurus");

const url = "https://blog.johnnyreilly.com";

/** @type {import('@docusaurus/types').Config} */
const config = {
	// ...
	presets: [
		[
			"@docusaurus/preset-classic",
			/** @type {import('@docusaurus/preset-classic').Options} */
			({
				// ...
				blog: {
					// ...
					rehypePlugins: [
						[
							docusaurusCloudinaryRemarkPlugin,
							{
								cloudName: "demo",
								baseUrl: url,
							},
						],
					],
					// ...
				},
				// ...
			}),
		],
	],
	// ...
};

Note: as is standard for Docusaurus Remark plugins at present, this is a commonjs module.

You will also need to disable the url-loader in your Docusaurus build which transforms images into base64 strings, as this will conflict with the plugin. There isn't a first class way to do this in Docusaurus at present. However by setting the environment variable WEBPACK_URL_LOADER_LIMIT to 0 you can disable it. You can see an implementation example in this pull request. It amounts to adding the cross-env package and then adding the following to your package.json:

	"build": "cross-env WEBPACK_URL_LOADER_LIMIT=0 docusaurus build",

See this package in action on: https://blog.johnnyreilly.com - the source code can be found here: https://github.com/johnnyreilly/blog.johnnyreilly.com. To read more on how this plugin came to be, see this blog post.

Development

See .github/CONTRIBUTING.md. Thanks! ❤️🌻

💙 This package is based on @JoshuaKGoldberg's template-typescript-node-package.

Keywords

FAQs

Last updated on 13 Jan 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc