Skip to content

fix: remove empty mini-program at-rules#1006

Draft
sonofmagic wants to merge 13 commits into
mainfrom
codex/fix-empty-media-at-rules
Draft

fix: remove empty mini-program at-rules#1006
sonofmagic wants to merge 13 commits into
mainfrom
codex/fix-empty-media-at-rules

Conversation

@sonofmagic

Copy link
Copy Markdown
Owner

Summary

修复小程序编译产物中残留空 @media@supports 等块级 at-rule 导致 WXSS 编译报错的问题。

Root Cause

空 at-rule 清理只覆盖主样式块,非主样式块、缓存资产和 CSS 覆盖合并路径可能在子规则被移除后保留空父容器;单次正向遍历也会漏掉嵌套空容器。

Changes

  • 添加自底向上的递归空 at-rule AST 清理。
  • 主包和非主包 PostCSS 后处理统一执行清理。
  • Vite 最终资产及缓存资产写回前执行结构清理。
  • 覆盖合并和生成 CSS 裁剪复用统一逻辑。
  • 保留 @import@charset 等语句型 at-rule。
  • 添加非主样式块和缓存产物回归测试。
  • 添加中文 changeset。

Verification

  • pnpm --filter @weapp-tailwindcss/postcss test:612 passed
  • pnpm --filter weapp-tailwindcss test:2980 passed,29 skipped
  • Vite processed CSS:43 passed
  • Vite bundle:208 passed
  • Webpack v5:165 passed
  • 相关 ESLint、PostCSS build、git diff --check 通过

weapp-tailwindcss 全量 TypeScript 检查仍受仓库现有跨模块类型错误影响,与本 PR 改动无关。

@changeset-bot

changeset-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 22c7ec6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@weapp-tailwindcss/postcss Patch
weapp-tailwindcss Patch
@weapp-tailwindcss/build-all Patch
@weapp-tailwindcss/experimental Patch
@weapp-tailwindcss/website Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sonofmagic
sonofmagic marked this pull request as draft July 21, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant