Skip to content

sen-ltd/tw-to-css

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tw-to-css

Demo

Paste Tailwind utility classes, get vanilla CSS — with a live preview.

Live demo: https://sen.ltd/portfolio/tw-to-css/

Screenshot

特徴

  • Pure parser in parser.js — no DOM, no browser dependency
  • Subset of Tailwind v3 default theme (~100 utilities covering spacing, colours, layout, typography, borders, radius, shadow)
  • 43 unit tests covering tokenisation, every utility category, unknown-class collection, and CSS rendering
  • Live preview that uses the resolved declarations directly (no Tailwind runtime, no JIT)
  • "Last class wins" same-property override (matches Tailwind's intuition without specificity tricks)
  • Zero dependencies, no build step

ローカル起動

npm run serve
# → http://localhost:8080

テスト

npm test

アーキテクチャ

tailwind-data.js  ← Tailwind v3 既定テーマのサブセット(カラーパレット、スペーシング、フォント等)
parser.js         ← トークナイザ + クラス → CSS 宣言マップ(DOM 非依存、テスト可能)
app.js            ← UI グルー(入力 → parser → preview / output)

parser.js の各ユーティリティは「ハンドラ関数」として登録される。1 ユーティリティ = 1 ハンドラ。新ルール追加は配列に push するだけで、テストも同じ粒度で書ける。

ライセンス

MIT. See LICENSE.

Links

About

Paste Tailwind utility classes, get vanilla CSS — with a live preview. Implements a subset of Tailwind v3's default theme (~100 utilities) via a pure parser and a lookup table. 43 unit tests.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors