@weapp-tailwindcss/cli 4.0.0-alpha.9 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,58 @@
1
1
  # @weapp-tailwindcss/cli
2
2
 
3
- `weapp-tailwindcss` 原生小程序 `CLI` 启动插件
3
+ > English | [简体中文](./README.zh-CN.md)
4
4
 
5
- 相关文档:
5
+ A Tailwind CSS v4 command-line interface for Web and mini-program CSS. It generates browser-compatible Web CSS by default and can emit mini-program-compatible CSS explicitly with `--target weapp`.
6
6
 
7
- 👉 [https://tw.icebreaker.top/](https://tw.icebreaker.top/docs/quick-start/native/install)
7
+ > [!IMPORTANT]
8
+ > Versions `3.x` and `4.0.0-alpha.x` on npm belong to the legacy Gulp workflow for native mini programs. The current CLI starts from the `5.x` release line and does not provide the legacy `init`, Sass/Less, or project-directory scanning workflow.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pnpm add -D @weapp-tailwindcss/cli weapp-tailwindcss tailwindcss
14
+ ```
15
+
16
+ ## Quick start
17
+
18
+ `weapp-tw` and `weapp-tailwindcss` are equivalent command names:
19
+
20
+ ```bash
21
+ pnpm exec weapp-tw -i src/input.css -o dist/output.css
22
+ pnpm exec weapp-tw build -i src/input.css -o dist/output.css --minify
23
+ pnpm exec weapp-tailwindcss canonicalize "py-3 p-1 px-3"
24
+ ```
25
+
26
+ The CLI reuses the Tailwind v4 generator, design system, and CSS transformation APIs from `weapp-tailwindcss`. It neither depends on nor invokes `@tailwindcss/cli`.
27
+
28
+ ## Output targets
29
+
30
+ | Target | Behavior |
31
+ | --- | --- |
32
+ | `web` | The default. Preserves Tailwind CSS browser selectors, escaping, and Web semantics. |
33
+ | `weapp` | Transforms generated CSS for mini-program style environments. |
34
+
35
+ `--target weapp` is CSS-only. It does not scan or rewrite WXML, JavaScript, TypeScript, JSX, TSX, or existing WXSS assets. Use the Vite, Webpack, Rspack, or Gulp integrations from `weapp-tailwindcss` for complete mini-program projects.
36
+
37
+ ## Watch mode
38
+
39
+ Watch mode uses native file-system events through `@parcel/watcher` by default. Pass `--poll` or `--poll=500` to use polling instead. The CLI also falls back automatically when the native watcher is unavailable.
40
+
41
+ ```bash
42
+ pnpm exec weapp-tw -i src/input.css -o dist/output.css --watch
43
+ pnpm exec weapp-tw -i src/input.css -o dist/output.css --watch --poll=500
44
+ ```
45
+
46
+ ## Programmatic API
47
+
48
+ ```ts
49
+ import { runCli } from '@weapp-tailwindcss/cli'
50
+
51
+ const exitCode = await runCli(['-i', 'src/input.css', '-o', 'dist/output.css'])
52
+ ```
53
+
54
+ Importing the package does not execute the CLI. `runCli` follows the same stdout, stderr, and `process.exitCode` behavior as the binary.
55
+
56
+ ## Documentation
57
+
58
+ See the [CLI guide](https://tw.icebreaker.top/docs/tools/weapp-tw-cli) for all options, stdin/stdout, source maps, watch mode, and `canonicalize`.
@@ -0,0 +1,58 @@
1
+ # @weapp-tailwindcss/cli
2
+
3
+ > [English](./README.md) | 简体中文
4
+
5
+ 面向 Web 与小程序 CSS 的 Tailwind CSS v4 命令行工具。默认保持浏览器语义生成 Web CSS,也可以通过 `--target weapp` 显式输出小程序兼容 CSS。
6
+
7
+ > [!IMPORTANT]
8
+ > npm 上的 `3.x` 与 `4.0.0-alpha.x` 属于旧版原生小程序 Gulp 工具链。当前 CLI 从 `5.x` 版本线开始发布,不再提供旧版 `init`、Sass/Less 或项目目录扫描流程。
9
+
10
+ ## 安装
11
+
12
+ ```bash
13
+ pnpm add -D @weapp-tailwindcss/cli weapp-tailwindcss tailwindcss
14
+ ```
15
+
16
+ ## 快速开始
17
+
18
+ `weapp-tw` 与 `weapp-tailwindcss` 是等价的命令入口:
19
+
20
+ ```bash
21
+ pnpm exec weapp-tw -i src/input.css -o dist/output.css
22
+ pnpm exec weapp-tw build -i src/input.css -o dist/output.css --minify
23
+ pnpm exec weapp-tailwindcss canonicalize "py-3 p-1 px-3"
24
+ ```
25
+
26
+ CLI 复用 `weapp-tailwindcss` 的 Tailwind v4 generator、design system 与 CSS 转换能力,不依赖或调用 `@tailwindcss/cli`。
27
+
28
+ ## 输出目标
29
+
30
+ | 目标 | 行为 |
31
+ | --- | --- |
32
+ | `web` | 默认目标,保留 Tailwind CSS 的浏览器选择器、转义与 Web 语义。 |
33
+ | `weapp` | 只转换生成后的 CSS,使其兼容小程序样式环境。 |
34
+
35
+ `--target weapp` 不扫描或改写 WXML、JavaScript、TypeScript、JSX、TSX 或已有 WXSS。完整小程序项目应继续使用 `weapp-tailwindcss` 的 Vite、Webpack、Rspack 或 Gulp 集成。
36
+
37
+ ## Watch
38
+
39
+ watch 默认使用 `@parcel/watcher` 原生文件系统事件。使用 `--poll` 或 `--poll=500` 可切换为轮询;原生 watcher 不可用时会自动降级。
40
+
41
+ ```bash
42
+ pnpm exec weapp-tw -i src/input.css -o dist/output.css --watch
43
+ pnpm exec weapp-tw -i src/input.css -o dist/output.css --watch --poll=500
44
+ ```
45
+
46
+ ## 程序化调用
47
+
48
+ ```ts
49
+ import { runCli } from '@weapp-tailwindcss/cli'
50
+
51
+ const exitCode = await runCli(['-i', 'src/input.css', '-o', 'dist/output.css'])
52
+ ```
53
+
54
+ 导入包不会自动执行命令。`runCli` 沿用命令行的 stdout、stderr 与 `process.exitCode` 语义。
55
+
56
+ ## 文档
57
+
58
+ 完整参数、stdin/stdout、source map、watch 与 `canonicalize` 用法见 [CLI 使用指南](https://tw.icebreaker.top/zh-cn/docs/tools/weapp-tw-cli)。
package/dist/bin.cjs ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ const require_src = require("./src-B7L6v_JY.cjs");
3
+ let node_process = require("node:process");
4
+ node_process = require_src.__toESM(node_process, 1);
5
+ //#region src/bin.ts
6
+ node_process.default.title = "node (@weapp-tailwindcss/cli)";
7
+ require_src.runCli().then((exitCode) => {
8
+ node_process.default.exitCode = exitCode;
9
+ });
10
+ //#endregion
package/dist/bin.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {}
package/dist/bin.js ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ import { t as runCli } from "./src-Cq9mSbsd.js";
3
+ import process from "node:process";
4
+ //#region src/bin.ts
5
+ process.title = "node (@weapp-tailwindcss/cli)";
6
+ runCli().then((exitCode) => {
7
+ process.exitCode = exitCode;
8
+ });
9
+ //#endregion
10
+ export {};