Skip to content

Conversation

@oasis-cloud
Copy link
Collaborator

@oasis-cloud oasis-cloud commented Apr 10, 2025

Summary by CodeRabbit

  • 文档更新
    • 增强了关于 CSS 与 SCSS 按需引入配置的说明,帮助用户更好地理解引入方式。
    • 更新了主题自定义文档,指导如何使用 SCSS 文件以及全局样式引入,提供了快速入门参考。
    • 新增了针对京东 APP(明亮/暗黑模式)、京东 JDesign 和京东 JRKF 主题的详细配置说明。
    • 修正了文档中的部分术语错误,提升了说明的准确性。

@github-actions github-actions bot added action:review This PR needs more reviews (less than 2 approvals) 3.x Target branch 3.x labels Apr 10, 2025
@codecov
Copy link

codecov bot commented Apr 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.20%. Comparing base (a7f79dd) to head (d9b969a).
Report is 2 commits behind head on feat_v3.x.

Additional details and impacted files
@@            Coverage Diff             @@
##           feat_v3.x    #3163   +/-   ##
==========================================
  Coverage      87.19%   87.20%           
==========================================
  Files            279      279           
  Lines          18540    18540           
  Branches        2821     2822    +1     
==========================================
+ Hits           16166    16167    +1     
+ Misses          2369     2368    -1     
  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.

@coderabbitai
Copy link

coderabbitai bot commented Apr 10, 2025

Walkthrough

本次变更主要更新了 NutUI-React 与 NutUI-React-Taro 文档中关于按需导入 CSS 与 SCSS 文件的说明。文档中在 vite/plugin 和 babel 配置部分增加了额外注释,明确说明了如何处理 CSS 与 SCSS 的导入方式,同时对 SCSS 文件的返回路径和某些拼写错误进行了修正。此次调整仅限于文档说明的补充,不涉及任何功能性更改。

Changes

文件(s) 修改说明
src/.../react/start-react.en-US.md
src/.../react/start-react.md
在 vite-plugin-imp 配置和 babel-plugin-import 配置中增加注释,说明 CSS 文件按需导入的方式以及 SCSS 文件采用新增的返回语句。
src/.../react/theme-react.en-US.md
src/.../react/theme-react.md
在主题定制说明中新增关于 SCSS 文件按需导入的说明,并提醒用户参考快速上手指南。
src/.../taro/start-react.en-US.md
src/.../taro/start-react.md
修改 babel 配置中的注释,明确说明 style: 'css' 用于按需导入 CSS 文件,并提示需要导入 SCSS 文件时可将 style 设置为 true。
src/.../taro/theme-react.en-US.md
src/.../taro/theme-react.md
在主题定制文档中新增 SCSS 文件按需导入说明,同时修正了 “ass-loader” 拼写错误为 “sass-loader”。
src/.../react/official-theme-react.en-US.md
src/.../react/official-theme-react.md
在主题配置部分新增关于全局类文件导入的说明,并列出各主题及其对应的 SCSS 文件名。
src/.../taro/official-theme-react.en-US.md
src/.../taro/official-theme-react.md
在主题配置部分新增关于全局类文件导入的说明,并列出各主题及其对应的 SCSS 文件名。

Possibly related PRs

Suggested reviewers

  • xiaoyatong
  • Alex-huxiyang

Poem

我是一只小兔子,跳跃在代码林间,
细语着文档更新,注释变得更明澈;
CSS 与 SCSS,如花般绽放,
按需导入的秘密,轻轻诉说温暖;
代码的春风中,我们一起欢畅 🐇✨
感谢每一处修改,让文档更加闪亮!
祝愿变更顺利,未来更加辉煌!

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6aa9789 and d9b969a.

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

🪧 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 plan to trigger planning for file edits and PR creation.
  • @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.

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: 1

🧹 Nitpick comments (6)
src/sites/sites-react/doc/docs/taro/theme-react.md (1)

23-24: 建议优化文档格式
当前新增的说明内容使用了加粗文本的格式。如果其目的是作为提示或说明标题,建议使用标题语法(例如 “#### 提示”)或引用块,以提高 Markdown 格式的一致性,并避免触发 markdownlint 的 MD036 警告。

下面是一份建议的 diff 改动:

-**使用 SCSS 文件自定义主题时,需将按需引入设置为 scss 文件的方式,参考快速入手中的自动按需加载配置项中的描述**
+**使用 SCSS 文件自定义主题时,请将按需引入配置设置为 SCSS 文件的方式。详细说明请参见快速上手章节中自动按需加载配置项的描述。**
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

23-23: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

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

26-26: 建议调整英文描述以提高表达准确性
当前文本“set the on-demand import to the SCSS file method”语句略显冗长且介词使用不够准确,建议调整为更简洁清晰的表达。

建议改为如下文本:

-**When customizing themes using SCSS files, you need to set the on-demand import to the SCSS file method. Refer to the description in the automatic on-demand loading configuration in the quick start guide.**
+**When customizing themes using SCSS files, you need to configure the on-demand import method to use SCSS files. Refer to the automatic on-demand loading configuration described in the quick start guide.**
🧰 Tools
🪛 LanguageTool

[uncategorized] ~26-~26: The preposition “of” seems more likely in this position.
Context: ...S file method. Refer to the description in the automatic on-demand loading configu...

(AI_EN_LECTOR_REPLACEMENT_PREPOSITION)


37-37: 建议修正标记符格式
此处 "** sass-loader**" 内存在多余的空格。建议去除空格,确保强调文本格式正确。

建议改为如下:

-Modify the ** sass-loader** configuration in the 'vite' or 'webpack' configuration file. The following example
+Modify the **sass-loader** configuration in the 'vite' or 'webpack' configuration file. The following example:
src/sites/sites-react/doc/docs/react/theme-react.md (1)

23-24: 建议优化文档用词
建议修改此处说明的语句,使表达更为准确和统一。

建议调整如下:

-**使用 SCSS 文件自定义主题时,需将按需引入设置为 scss 文件的方式,参考快速入手中的自动按需加载配置项中的描述**
+**使用 SCSS 文件自定义主题时,请将按需引入配置设置为 SCSS 文件的方式。详细说明请参见快速上手章节中自动按需加载配置项的描述。**
src/sites/sites-react/doc/docs/taro/theme-react.en-US.md (2)

26-26: 建议调整英文描述以提高表达清晰度
建议对该处英文提示进行小幅调整,使语句更加流畅、准确。

建议修改如下:

-**When customizing themes using SCSS files, you need to set the on-demand import to the SCSS file method. Refer to the description in the automatic on-demand loading configuration in the quick start guide.**
+**When customizing themes using SCSS files, you need to configure the on-demand import method to use SCSS files. Refer to the automatic on-demand loading configuration described in the quick start guide.**
🧰 Tools
🪛 LanguageTool

[uncategorized] ~26-~26: The preposition “of” seems more likely in this position.
Context: ...S file method. Refer to the description in the automatic on-demand loading configu...

(AI_EN_LECTOR_REPLACEMENT_PREPOSITION)


37-37: 建议修正标记中多余的空格
“** sass-loader**” 中的多余空格建议去除,确保格式整洁。

建议调整如下:

-Modify the ** sass-loader** configuration in the 'vite' or 'webpack' configuration file. The following example
+Modify the **sass-loader** configuration in the 'vite' or 'webpack' configuration file. The following example:
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

37-37: Spaces inside emphasis markers
null

(MD037, no-space-in-emphasis)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cc94ce3 and 67c0071.

📒 Files selected for processing (8)
  • src/sites/sites-react/doc/docs/react/start-react.en-US.md (2 hunks)
  • src/sites/sites-react/doc/docs/react/start-react.md (2 hunks)
  • src/sites/sites-react/doc/docs/react/theme-react.en-US.md (1 hunks)
  • src/sites/sites-react/doc/docs/react/theme-react.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)
  • src/sites/sites-react/doc/docs/taro/theme-react.en-US.md (2 hunks)
  • src/sites/sites-react/doc/docs/taro/theme-react.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
src/sites/sites-react/doc/docs/react/theme-react.en-US.md

[uncategorized] ~26-~26: The preposition “of” seems more likely in this position.
Context: ...S file method. Refer to the description in the automatic on-demand loading configu...

(AI_EN_LECTOR_REPLACEMENT_PREPOSITION)

src/sites/sites-react/doc/docs/taro/theme-react.en-US.md

[uncategorized] ~26-~26: The preposition “of” seems more likely in this position.
Context: ...S file method. Refer to the description in the automatic on-demand loading configu...

(AI_EN_LECTOR_REPLACEMENT_PREPOSITION)

🪛 markdownlint-cli2 (0.17.2)
src/sites/sites-react/doc/docs/taro/theme-react.en-US.md

37-37: Spaces inside emphasis markers
null

(MD037, no-space-in-emphasis)

src/sites/sites-react/doc/docs/taro/theme-react.md

23-23: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

🔇 Additional comments (3)
src/sites/sites-react/doc/docs/taro/start-react.md (1)

1-221: 无明显修改,文档内容整体清晰
当前文档内容逻辑清晰且描述详细,未检测到针对本次 PR 的新增或修改内容。

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

143-143: 文档注释更新得当
在 Babel 配置中,对 style 属性的注释增强了说明,明确指出如果需要导入 SCSS 文件,可以将 style 设置为 true,从而帮助用户更好地理解可选的样式导入方式。

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

138-138: Babel 配置注释更新良好
在 Babel 插件的配置中,对 style 属性的注释进行了改进,清晰地说明了默认按需导入 CSS 文件以及如何通过设置为 true 来导入 SCSS 文件,非常直观。

Comment on lines 93 to +97
style: (name) => {
// 按需引入 css 文件的处理,两种方式择其一
return `@nutui/nutui-react/dist/es/packages/${name.toLowerCase()}/style/css`
// 按需引入 scss 文件的处理,两种方式择其一
return `@nutui/nutui-react/dist/es/packages/${name.toLowerCase()}/style`
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

建议优化返回语句逻辑
vite-plugin-imp 的配置示例中,style 函数内存在连续两个 return 语句,其中第一个 return 会使第二个返回永远无法执行。这可能会给用户造成困惑。建议将其中一个返回语句注释掉,并提供详细说明,让用户根据需要选择对应的导入方式。例如,可以保留“按需引入 CSS 文件”的 return,而将“按需引入 SCSS 文件”的返回语句注释掉,并在注释中说明如何切换。

-          style: (name) => {
-            // 按需引入 css 文件的处理,两种方式择其一
-            return `@nutui/nutui-react/dist/es/packages/${name.toLowerCase()}/style/css`
-            // 按需引入 scss 文件的处理,两种方式择其一
-            return `@nutui/nutui-react/dist/es/packages/${name.toLowerCase()}/style`
-          },
+          style: (name) => {
+            // 根据需要选择导入方式,注释掉不使用的方案:
+            // 方案一:按需引入 CSS 文件
+            // return `@nutui/nutui-react/dist/es/packages/${name.toLowerCase()}/style/css`;
+            // 方案二:按需引入 SCSS 文件
+            return `@nutui/nutui-react/dist/es/packages/${name.toLowerCase()}/style`;
+          },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
style: (name) => {
// 按需引入 css 文件的处理,两种方式择其一
return `@nutui/nutui-react/dist/es/packages/${name.toLowerCase()}/style/css`
// 按需引入 scss 文件的处理,两种方式择其一
return `@nutui/nutui-react/dist/es/packages/${name.toLowerCase()}/style`
style: (name) => {
// 根据需要选择导入方式,注释掉不使用的方案:
// 方案一:按需引入 CSS 文件
// return `@nutui/nutui-react/dist/es/packages/${name.toLowerCase()}/style/css`;
// 方案二:按需引入 SCSS 文件
return `@nutui/nutui-react/dist/es/packages/${name.toLowerCase()}/style`;
},

@xiaoyatong xiaoyatong merged commit 794a53f into jdf2e:feat_v3.x Apr 11, 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.

3 participants