Registry / web-framework / typewritingclass-compiler

typewritingclass-compiler

JSON →
library0.3.2jsnpmunverified

Rust-powered static CSS extraction compiler and Vite plugin for Typewriting Class v0.3.2. It statically analyzes TypeScript/JavaScript source files at build time, extracts utility class calls (tw, cx, when), generates deterministic CSS class names and declarations, and replaces call sites with those names for zero-runtime CSS output. Released weekly. Key differentiators: Rust-based performance, strict mode requiring explicit dynamic() wrapping, and Solid.js plugin ordering requirement.

npm install typewritingclass-compiler
INSTALL
IMPORT
SIG · TYPEWRITINGCLASS-C
T
typewritingclass-compiler
web-frameworkjavascriptv0.3.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

twcPlugin
import twcPlugin from 'typewritingclass-compiler'
const twcPlugin = require('typewritingclass-compiler')
ESM-only since v0.1; no named default export, use import default.
nativeTransform
import { nativeTransform } from 'typewritingclass-compiler'
import nativeTransform from 'typewritingclass-compiler'
Named export, not default.
ThemeInput
import type { ThemeInput } from 'typewritingclass-compiler'
const { ThemeInput } = require('typewritingclass-compiler')
TypeScript type only, cannot be required.

Sets up Vite plugin with Solid.js, imports virtual CSS module, and uses `tw` from typewritingclass.

// vite.config.ts import { defineConfig } from 'vite' import twcPlugin from 'typewritingclass-compiler' import solid from 'vite-plugin-solid' export default defineConfig({ plugins: [twcPlugin(), solid()], }) // src/main.tsx import 'virtual:twc.css' import { tw } from 'typewritingclass' function App() { return <div className={tw('bg-blue-500 text-white p-4')}>Hello</div> }
Debug
Known issues
gotchaSolid.js plugin must come AFTER twcPlugin in the plugins array
fix
Ensure plugins order: [twcPlugin(), solid()]
affects: >=0.1.0
breakingStrict mode is enabled by default; dynamic values must be wrapped with dynamic()
fix
Wrap dynamic values: tw(dynamic(expr)) or set strict: false in options
affects: >=0.2.0
gotchavirtual:twc.css must be imported in your entry file
fix
Add import 'virtual:twc.css' at the top of your main file
affects: >=0.1.0
deprecatedCommonJS require() is not supported; ESM-only
fix
Use import statements or set type: 'module' in package.json
affects: >=0.1.0
Errors
Common errors & fixes
Cannot find module 'virtual:twc.css'
Virtual module not registered because twcPlugin() is missing from Vite config
fix
Add twcPlugin() to your Vite plugins array and restart the dev server.
TypeError: twcPlugin is not a function
Importing default export incorrectly (e.g., using named import)
fix
Use default import: import twcPlugin from 'typewritingclass-compiler'
Error: Dynamic value must be wrapped with dynamic()
Strict mode enabled and a non-static value passed to tw()
fix
Wrap the value: tw(dynamic(expr)) or disable strict mode with twcPlugin({ strict: false })
Upgrade
Version history
0.3.2latest on npm
Audit
Dependencies
viterequiredpeer dependency for Vite plugin functionality
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
typewritingclass-compiler — npm install typewritingclass-compiler · libregistry