Skip to content

pantoken / bundlers/vite/src / pantoken

Fonction: pantoken()

pantoken(options?): Plugin

Expérimental

Le plugin Vite de pantoken.

Paramètres

options?

PantokenViteOptions = {}

PantokenViteOptions.

Retourne

Plugin

Un Plugin pour Vite.

Exemples

Enregistrez le plugin dans vite.config.ts

ts
import { defineConfig } from "vite";
import { pantoken } from "@pantoken/vite";

export default defineConfig({
  plugins: [pantoken()],
});

Injectez automatiquement la feuille de style dans le HTML <head>

ts
import { defineConfig } from "vite";
import { pantoken } from "@pantoken/vite";

export default defineConfig({
  // No need to import `virtual:pantoken/css` yourself — it's injected.
  plugins: [pantoken({ injectCss: true })],
});

Utilisez les modules virtuels dans le code de l'application

ts
import css from "virtual:pantoken/css"; // the stylesheet string
import { tokens } from "virtual:pantoken/tokens"; // the resolved token IR