Skip to main content

stacks-crosswind

Use when styling Stacks templates with Crosswind utilities, configuring the ts-css engine, responsive or dark variants, theme tokens, shortcuts, safelists, or debugging generated CSS. Covers config/css.ts and @stacksjs/ts-css/engine.

소스 정보

저장소
stacksjs/stacks
최근 소스 활동
2026년 10월 10일 17:01
감지된 SKILL.md 언어
영어
스타
633
포크
20

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
stacks-crosswind
description
Use when styling Stacks templates with Crosswind utilities, configuring the ts-css engine, responsive or dark variants, theme tokens, shortcuts, safelists, or debugging generated CSS. Covers config/css.ts and @stacksjs/ts-css/engine.
license
MIT
compatibility
Bun >= 1.3.0, TypeScript
allowed-tools
Read Edit Write Bash Grep Glob
# Stacks utility CSS Use Crosswind utility classes in STX. The current framework implements this through `@stacksjs/ts-css/engine`, the successor package used by STX and `@stacksjs/ui`; do not copy an old `@cwcss/crosswind` import into this checkout. Pair visually important work with `stacks-design-taste`. ## Configuration and delivery `config/css.ts` is the authoritative application config, typed as `CssOptions` from `@stacksjs/ts-css/engine`. `config/ui.ts` instead configures STX, including its root and stateDir. STX's loader accepts a legacy crosswind config as a deprecated fallback; prefer the css name for new projects. ```ts import type { CssOptions } from '@stacksjs/ts-css/engine' export default { content: ['./resources/**/*.{stx,html}'], minify: false, } satisfies CssOptions ``` The default config also includes framework component/view roots. Preserve those when replacing application content globs. The STX server generates CSS for the page's extracted classes and caches it under `storage/framework/stx/cache/cw-<hash>.css`. The historical cw prefix does not mean that the old package is loaded. Cache output is runtime state, not source. For engine-level work, inspect the installed `CssOptions` and exports rather than copying a handwritten interface. The engine exposes `CSSGenerator`: ```ts import { CSSGenerator, defaultConfig } from '@stacksjs/ts-css/engine' const generator = new CSSGenerator(defaultConfig) generator.generate('hover:bg-blue-600') const css = generator.toCSS() ``` ## Template authoring Use static complete class names so extraction can find the selected utilities. For stateful classes use literal branches, for example `:class="active() ? 'bg-blue-600' : 'bg-gray-200'"`, rather than assembling `'bg-' + color`. If a class only exists in runtime data, deliberately safelist it in the engine config after checking the config's actual type. Responsive variants (`md:`, `lg:`), state variants (`hover:`, `focus-visible:`), `dark:`, arbitrary values and `motion-reduce:` are ordinary utilities. Theme, shortcut and custom-rule support belongs in css config. Validate an uncommon utility by checking emitted CSS in the installed engine; familiar Tailwind syntax alone does not establish support. ## Gotchas - Preflight configuration uses `preflights` objects. A top-level boolean `preflight` is not the engine option; the base reset already ships. - Dark utilities require the appropriate root appearance state. Use `useColorMode()` and STX `@appearanceBootstrap` for persisted pre-paint setup. - Keep fonts and colors in application tokens/config; a utility does not download a font or introduce an icon dependency. - Use CSS transitions/keyframes and scroll-driven CSS for motion. Browser observation and reduced-motion helpers are documented in `stacks-composables`, including cleanup and client-delivery boundaries. - Content hashes include config/class inputs. A cache file should never be hand-edited to fix a source class or token. ## Source and evidence `config/css.ts`, `config/ui.ts`, `core/ui/src/index.ts` and `core/ui/package.json` establish the framework boundary. The installed STX `dev-server/ts-css` module establishes loader precedence, class extraction and cache behavior. Relevant upstream tests include `test/dev-server/ts-css-extraction.test.ts` and `test/ts-css-shortcut-precedence.test.ts`. Core paths are relative to `storage/framework/`.
GitHub에서 보기