Skip to content

Installation

Terminal window
pnpm add typewritingclass
pnpm add -D typewritingclass-compiler
vite.config.ts
import { defineConfig } from 'vite'
import twcPlugin from 'typewritingclass-compiler'
export default defineConfig({
plugins: [twcPlugin()],
})

The plugin handles CSS extraction and injection automatically. No manual imports needed.

For other bundlers see the esbuild plugin or Babel plugin docs. For Next.js see the Next.js integration guide.

// src/main.ts (or main.tsx, index.tsx, etc.)
import 'typewritingclass/preflight.css'
import { tw } from 'typewritingclass'
function App() {
return <div className={tw.p(6).bg.blue500.textColor.white.rounded.lg}>It works!</div>
}

Start your dev server. You should see a blue rounded box with white text.