Installation
Unplugin
Install the unplugin
pnpm add -D @pikacss/unplugin-pikacssyarn add -D @pikacss/unplugin-pikacssnpm install -D @pikacss/unplugin-pikacssApply the vite plugin (or other supported bundlers)
import pikacss from '@pikacss/unplugin-pikacss/vite'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [
pikacss({ /* options */ }),
],
})Import the virtual module
import 'pika.css'Nuxt
Install the nuxt module
pnpm add -D @pikacss/nuxt-pikacssyarn add -D @pikacss/nuxt-pikacssnpm install -D @pikacss/nuxt-pikacssApply the nuxt module
export default defineNuxtConfig({
modules: [
'@pikacss/nuxt-pikacss',
],
pikacss: { /* options */ },
})Auto Generated Files
pika.config.ts / pika.config.js
The PikaCSS engine configuration file. Generated automatically once if no configuration file or inline config is found. Contains engine options like prefix, selectors, plugins, preflights, etc.
pika.gen.ts
TypeScript code generation file providing type definitions and auto-completion support for PikaCSS utilities. Critical for DX: Enables IDE auto-completion and type safety when using PikaCSS functions.
The auto-generated pika.config.ts includes a reference line that automatically includes type definitions into TypeScript's type system:
/// <reference path="./src/pika.gen.ts" />If you use inline config or other advanced setups, ensure pika.gen.ts is included in your type system via:
- The reference comment in config file (recommended)
tsconfig.jsonincludepaths- IDE settings
Safe to add to .gitignore as it's auto-generated.
pika.gen.css
CSS code generation file containing all scanned atomic styles used in your project. Automatically generated during development. Safe to add to .gitignore.
It's recommended to add
pika.gen.tsandpika.gen.cssto your.gitignorefile as they are auto-generated files and should not be committed to version control.
Plugin Options
scan
Configure file patterns for scanning pika() function calls.
include: File patterns to scan (default:['**/*.{js,ts,jsx,tsx,vue}'])exclude: File patterns to exclude (default:['node_modules/**'])
config
Engine configuration object or path to a config file.
- Pass an object:
{ prefix: 'pika-', defaultSelector: '.%' } - Or a file path:
'./pika.config.ts'
autoCreateConfig
Whether to automatically create a configuration file when needed. Default: true
fnName
The name of the PikaCSS function in source code. Default: 'pika'
transformedFormat
Format of generated class names.
'string': Space-separated string (default) -"a b c"'array': Array of class names -['a', 'b', 'c']'inline': Object format for style objects
tsCodegen
TypeScript code generation configuration.
true: Auto-generate aspika.gen.ts(default)string: Custom file path -'src/pika.gen.ts'false: Disable
cssCodegen
CSS code generation configuration.
true: Auto-generate aspika.gen.css(default)string: Custom file path -'src/styles/generated.css'