Skip to content

pantoken / bundlers/vite/src / pantoken

Funkcja: pantoken()

pantoken(options?): Plugin

Eksperymentalne

Wtyczka Vite dla pantoken.

Parametry

options?

PantokenViteOptions = {}

PantokenViteOptions.

Zwraca

Plugin

Wtyczka Vite Plugin.

Przykłady

Zarejestruj wtyczkę w vite.config.ts

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

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

Automatycznie wstrzykuj arkusz stylów do 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 })],
});

Użyj wirtualnych modułów w kodzie aplikacji

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