@teacss/vite-ts
v0.10.11
Published
Vite plugin for TeaCSS.
Downloads
2,052
Readme
@teacss/vite-ts
Vite plugin for TeaCSS.
import { defineConfig } from "vite";
import { pluginTeacss } from "@teacss/vite-ts";
export default defineConfig({
plugins: [pluginTeacss()],
});import "virtual:teacss.css";/* src/index.css */
@presets "standard";
@teacss;The plugin looks for the CSS entry under the Vite root, in this order: the
package.json teacss.entry path, index.css, then src/index.css. The last
two count only when they contain a top-level @teacss;. With no entry and no
presets in the plugin options, it warns and the stylesheet is empty.
Utilities come from the modules Vite loads, filtered by the default pipeline.
.tsx, .jsx, .html, .vue, .svelte, .astro and .md modules are
scanned. A plain .ts or .js module is scanned only when it contains
// @teacss-include. @source does not change this.
The plugin scans Vite modules, transforms TeaCSS directives, provides stylesheet HMR, and emits final CSS assets. Production waits for transformed modules, passes generated rules through Vite's CSS transform and minifier, and includes the final CSS digest in dependent chunk hashes. Fixed asset names stay fixed. Generated utility CSS has no build sourcemap.
When Lightning CSS is configured, calculated Bézier x coordinates are guarded before direct CSS/CSS Modules parsing and generated-preflight optimization. With the PostCSS transformer, the guard runs after user plugins and imports, before Lightning CSS minification. Authored source maps are retained. Native Lightning CSS processing captures the exact CSS returned by Vite's resolver, including compiled Sass and Less in entries and imports. Original source locations identify proven calculated timing values for repair before minification. CSS Modules, assets, source maps and user visitors retain their native behavior. Preprocessor hooks run once; compiler options, worker selection and import resolution remain Vite-owned. No transformer change is needed. See the easing audit for coverage and limitations.
Pre-1.0. Install this adapter and the entry's preset packages as development dependencies.
Development and production watch builds track source-scanned CSS declarations,
including new files, deleted files, recreated files, and initially missing external
absolute @source roots. This updates shortcuts and safelists; utility extraction
still follows Vite's loaded module graph and pipeline filters.
A bounded declaration check every 500 ms also recovers changes omitted by native
callbacks; unchanged declarations do not reload configuration or rebuild.
Glob-matched CSS file symlinks observe their physical file targets through filtered shallow parent watches, including recovery after a failed member read. Nested source directory symlinks observe physical target changes, including empty targets and target deletion or recreation. Missing routes use shallow parent observation. Failed reads retain the last accepted configuration.
