Socket
Book a DemoInstallSign in
Socket

cloudflare-fonts

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudflare-fonts

Library for using Cloudflare Fonts with React's SSR

0.0.2
latest
Source
npmnpm
Version published
Weekly downloads
5
-37.5%
Maintainers
0
Weekly downloads
 
Created
Source

cloudflare-fonts

description

Library for using Cloudflare Fonts with React's SSR

Adjusts output content so that React hydration does not fail if Cloudflare rewrites the HTML content

URL of sample program

https://cloudflare-fonts.croud.jp/

https://github.com/SoraKumo001/react-router-cloudflare-fonts

Easiest example.

Shows how to use Cloudflare Fonts on the React Router. Adjust the output content on the React Router.

  • app/root.tsx

Use CloudflareFonts to configure font settings.

import { CloudflareFonts } from "cloudflare-fonts";

export function Layout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <head>
        <meta charSet="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <Meta />
        <Links />
        <CloudflareFonts
          href={[
            "https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@100..900&display=swap",
            "https://fonts.googleapis.com/css2?family=Kaisei+Decol&display=swap",
            "https://fonts.googleapis.com/css2?family=Dela+Gothic+One&display=swap",
          ]}
        />
      </head>
      <body>
        {children}
        <ScrollRestoration />
        <Scripts />
      </body>
    </html>
  );
}
  • app/routes/_index.tsx
export default function Index() {
  const fonts = ["Noto Sans JP", "Kaisei Decol", "Dela Gothic One"];

  return (
    <div className="text-4xl">
      {fonts.map((v) => (
        <div key={v} style={{ fontFamily: v }}>
          日本語フォント:{v}
        </div>
      ))}
    </div>
  );
}

Keywords

cloudflare

FAQs

Package last updated on 17 Feb 2025

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.