Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: 补充web 设置 px 转 rem时的文档 #3098

Merged
merged 2 commits into from
Mar 19, 2025

Conversation

xiaoyatong
Copy link
Collaborator

@xiaoyatong xiaoyatong commented Mar 18, 2025

🤔 这个变动的性质是?

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

💡 需求背景和解决方案

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • fork仓库代码是否为最新避免文件冲突
  • Files changed 没有 package.json lock 等无关文件

Summary by CodeRabbit

  • 文档
    • 更新了 NutUI-React 的 CSS 单位转换说明,新增提示:为避免将 NutUI 相关样式转换,从 px 到 rem 的过程中应在 PostCSS 配置中排除以 "nut-" 开头的选择器,并提供了配置示例。
    • 新增关于 Taro 中 CSS 单位使用的说明,强调在编译过程中需要将 NutUI 相关样式排除在转换之外,并提供了相关配置示例。

Sorry, something went wrong.

Copy link

coderabbitai bot commented Mar 18, 2025

Walkthrough

文档更新增加了关于 NutUI-React 框架下 CSS 单位转换的指导,阐述如何将 px 转换为 rem。新指导特别强调在 PostCSS 配置中,需通过 selectorBlackList 选项排除以 nut- 开头的类名,避免这些样式被转换。两个相关文档分别在英文及中文版本中进行了此说明和配置示例的补充。

Changes

文件 变更摘要
src/.../start-react.en-US.md
src/.../start-react.md
文档中增加了关于 CSS 单位转换的说明,补充了 PostCSS 配置示例,其中包括 selectorBlackList 设置,用于排除以 nut- 开头的类名,防止转换问题。
src/.../taro/start-react.en-US.md
src/.../taro/start-react.md
新增了关于 CSS 单位的章节,说明组件使用 px 作为 CSS 单位,并强调在 Taro 编译过程中需将 NutUI 相关样式添加到黑名单,以防止其被转换。提供了配置示例以说明如何在 config/index.js 中设置。

Suggested reviewers

  • Alex-huxiyang

Poem

我是小兔,跳跃嬉戏,
见证文档中妙语连珠。
PostCSS加黑名单,
保护样式不乱转换。
技术点滴似萝卜,
营造开发乐无边。
🐰 欢庆更新,共赏春天!

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@xiaoyatong xiaoyatong requested a review from oasis-cloud March 18, 2025 14:44
@github-actions github-actions bot added action:review This PR needs more reviews (less than 2 approvals) 3.x Target branch 3.x labels Mar 18, 2025
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.49%. Comparing base (3fd5483) to head (4a63515).
Report is 4 commits behind head on feat_v3.x.

Additional details and impacted files
@@            Coverage Diff             @@
##           feat_v3.x    #3098   +/-   ##
==========================================
  Coverage      86.48%   86.49%           
==========================================
  Files            280      280           
  Lines          18489    18492    +3     
  Branches        2774     2774           
==========================================
+ Hits           15991    15994    +3     
  Misses          2493     2493           
  Partials           5        5           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
src/sites/sites-react/doc/docs/react/start-react.md (2)

153-155: 文本说明清晰,建议补充细节说明
文档中新增的说明已经清楚地指出了在进行 px 转 rem 转换时,需要通过配置 selectorBlackList: ['nut-'] 来排除 NutUI 相关的样式。建议增加一句解释:说明为何(例如防止组件样式被错误转换)需要排除以 nut- 开头的类名,以及这样做对项目布局或样式带来的好处。


156-165: 代码块建议添加语言标识
静态分析工具提示未为代码块指定语言,这可能影响代码高亮与可读性。建议修改为:

-```
+```js

这样可以提高代码示例的可读性,并符合 markdownlint 的要求。

src/sites/sites-react/doc/docs/react/start-react.en-US.md (2)

151-155: Documentation text clarity and language refinement
The updated text clearly explains that when converting px to rem, NutUI-related CSS classes should be excluded by configuring the postcss plugin appropriately. However, the phrase “Be attention” is non-standard in English; consider using “Please note” or “Note that” to improve clarity and professionalism.


156-165: Add code block language for enhanced readability
Similar to the Chinese version, the fenced code block lacks a language specifier. It is recommended to specify the language (e.g., ```js) for better syntax highlighting and to comply with markdownlint guidelines.

-```
+```js
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

156-156: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3fd5483 and caebed3.

📒 Files selected for processing (2)
  • src/sites/sites-react/doc/docs/react/start-react.en-US.md (1 hunks)
  • src/sites/sites-react/doc/docs/react/start-react.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
src/sites/sites-react/doc/docs/react/start-react.en-US.md

156-156: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test

Copy link
Collaborator

@oasis-cloud oasis-cloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

taro 目录中的也可以改一下

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@pull-request-size pull-request-size bot added size/M and removed size/S labels Mar 19, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/sites/sites-react/doc/docs/taro/start-react.en-US.md (1)

196-211: 新增 “CSS units” 节,文档描述清晰明确。

新增部分详细说明了组件使用的 CSS 单位(px),同时指出 Taro 在编译时会对样式执行尺寸转换操作,并提醒用户在配置中将 NutUI 相关样式加入黑名单,防止转换。这部分示例代码(config/index.js 的 postcss 配置)规范且直观。建议增加对 pxtransform 插件的简单说明或提供链接,帮助用户进一步了解相关配置细节。

src/sites/sites-react/doc/docs/taro/start-react.md (1)

200-215: 新增 “样式单位转化” 节,内容详实且易于理解。

文档中新增的“样式单位转化”节说明了组件采用 px 作为 CSS 单位,并解释了 Taro 编译过程中如何进行单位转换,同时详细展示了在配置文件中如何通过 postcsspxtransform 配置与黑名单 selectorBlackList 来排除 NutUI 相关样式。示例代码和注释均表达清楚用途。建议检查文档内各部分描述的一致性,以保证英文版和中文版的信息相互补充,并考虑加入更多关于配置场景的说明。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between caebed3 and 4a63515.

📒 Files selected for processing (3)
  • src/sites/sites-react/doc/docs/react/start-react.en-US.md (1 hunks)
  • src/sites/sites-react/doc/docs/taro/start-react.en-US.md (1 hunks)
  • src/sites/sites-react/doc/docs/taro/start-react.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/sites/sites-react/doc/docs/react/start-react.en-US.md
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test

@oasis-cloud oasis-cloud merged commit febca3e into jdf2e:feat_v3.x Mar 19, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Target branch 3.x action:review This PR needs more reviews (less than 2 approvals) size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants