Skip to content

feat: introduce css icons#32004

Draft
hyoban wants to merge 6 commits intomainfrom
2-5-css-icon
Draft

feat: introduce css icons#32004
hyoban wants to merge 6 commits intomainfrom
2-5-css-icon

Conversation

@hyoban
Copy link
Member

@hyoban hyoban commented Feb 5, 2026

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Fixes #30797
rework #31551

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint and make type-check (backend) and cd web && npx lint-staged (frontend) to appease the lint gods

@hyoban hyoban requested a review from iamjoel as a code owner February 5, 2026 10:28
Copilot AI review requested due to automatic review settings February 5, 2026 10:28
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 5, 2026
@github-actions github-actions bot added the web This relates to changes on the web. label Feb 5, 2026
@dosubot dosubot bot added the 💪 enhancement New feature or request label Feb 5, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hyoban, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors how icons are managed and used within the project by introducing a new ESLint rule and integrating Tailwind CSS for icon styling. The primary goal is to standardize icon usage, promote a utility-first approach, and potentially improve frontend performance and maintainability by leveraging Tailwind's capabilities for icons.

Highlights

  • New ESLint Rule for Icon Usage: Introduced a new ESLint rule named prefer-tailwind-icon to enforce the use of Tailwind CSS icon classes over direct component imports for icons. This rule includes auto-fix suggestions to convert JSX icon components into <span> elements with appropriate Tailwind classes, handling size, width, and height props.
  • Tailwind CSS Icon Integration: Configured Tailwind CSS to integrate various icon collections, including heroicons, remixicon, and custom SVG icons from specified local paths. This enables the use of utility classes for icons, streamlining icon management and styling.
  • Dependency Updates: Added new development dependencies such as @egoist/tailwindcss-icons, @iconify-json/heroicons, @iconify-json/ri, and iconify-import-svg to support the new icon system. The pnpm-lock.yaml file has been updated to reflect these changes and their transitive dependencies.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • web/eslint-rules/index.js
    • Imported and registered the new preferTailwindIcon ESLint rule into the Dify ESLint plugin.
  • web/eslint-rules/rules/prefer-tailwind-icon.js
    • Added a new ESLint rule that suggests replacing imported icon components with Tailwind CSS icon classes.
    • Implemented logic to identify icon imports from @remixicon/react, @heroicons/react, and custom local paths.
    • Provided auto-fix functionality to transform JSX icon components into <span> elements with generated Tailwind icon classes, including handling size, width, and height attributes.
    • Added reporting for icon imports that are not used as JSX components but could be replaced by Tailwind classes.
  • web/eslint.config.mjs
    • Enabled the new dify/prefer-tailwind-icon ESLint rule as a warning for .tsx files to guide developers towards the new icon usage pattern.
  • web/package.json
    • Added @egoist/tailwindcss-icons for Tailwind CSS icon integration.
    • Included @iconify-json/heroicons and @iconify-json/ri for Heroicons and Remixicon collections.
    • Added iconify-import-svg for importing custom SVG icon collections.
  • web/pnpm-lock.yaml
    • Updated the lock file to include new dependencies and their transitive dependencies required for the Tailwind CSS icon integration and the new ESLint rule.
  • web/tailwind-common-config.ts
    • Imported necessary modules (path, fileURLToPath, getIconCollections, iconsPlugin, importSvgCollections) for Tailwind icon configuration.
    • Configured the Tailwind CSS plugins array to include iconsPlugin.
    • Integrated heroicons and remixicon collections using getIconCollections.
    • Added custom SVG icon collections from app/components/base/icons/assets/public and app/components/base/icons/assets/vender with specific prefixes using importSvgCollections.
    • Set default width, height, and display properties for the generated icon classes.
Activity
  • The pull request addresses and fixes issue [Refactor/Chore] Introduce CSS icons #30797.
  • The author has confirmed adherence to contribution guidelines.
  • Tests have been added for each introduced change, aiming for atomic changes.
  • Documentation has been updated to reflect the new icon system.
  • Linting and type-checking checks were successfully run.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new system for using CSS icons with Tailwind, which is a great improvement for consistency and performance. A new ESLint rule prefer-tailwind-icon is added to encourage the adoption of this new system by suggesting replacements for old icon components. The implementation is solid, but I've found a couple of areas in the new ESLint rule that could be improved for robustness.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces CSS-based icons using Tailwind CSS icon utilities to replace component-based icon libraries. It adds a new ESLint rule to encourage the migration from icon library components to Tailwind CSS classes.

Changes:

  • Adds Tailwind CSS icons plugin with support for Heroicons, Remix Icons, and custom SVG collections
  • Implements a custom ESLint rule (prefer-tailwind-icon) to suggest replacing icon components with Tailwind classes
  • Adds necessary dependencies for icon handling (@egoist/tailwindcss-icons, iconify-import-svg, and icon collection packages)

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
web/tailwind-common-config.ts Configures Tailwind icons plugin with icon collections and custom SVG support
web/package.json Adds dependencies for Tailwind icons and icon collections
web/eslint.config.mjs Enables the new prefer-tailwind-icon rule for TSX files
web/eslint-rules/rules/prefer-tailwind-icon.js Implements ESLint rule to detect and suggest replacing icon components with Tailwind classes
web/eslint-rules/index.js Registers the new prefer-tailwind-icon rule in the plugin
Files not reviewed (1)
  • web/pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hyoban hyoban marked this pull request as draft February 5, 2026 10:35
Copilot AI review requested due to automatic review settings February 5, 2026 13:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • web/pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings February 5, 2026 17:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • web/pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"esbuild": "0.27.2",
"eslint": "9.39.2",
"eslint-plugin-better-tailwindcss": "4.1.1",
"eslint-plugin-better-tailwindcss": "https://pkg.pr.new/hyoban/eslint-plugin-better-tailwindcss@c0161c7",
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The eslint-plugin-better-tailwindcss dependency has been changed from a version number (4.1.1) to a direct GitHub tarball URL pointing to a specific commit (c0161c7) on pkg.pr.new. This is concerning because:

  1. It uses an unstable package source (pkg.pr.new is for preview builds from PRs)
  2. The specific commit may not be guaranteed to remain available long-term
  3. This makes the build less reproducible and potentially less stable
  4. The PR description doesn't explain why this change is necessary

This change should either be reverted to use a stable version from npm, or a clear explanation should be provided in the PR description about why the preview build is necessary and what the plan is to migrate back to a stable release.

Suggested change
"eslint-plugin-better-tailwindcss": "https://pkg.pr.new/hyoban/eslint-plugin-better-tailwindcss@c0161c7",
"eslint-plugin-better-tailwindcss": "4.1.1",

Copilot uses AI. Check for mistakes.
}),
...importSvgCollections({
source: path.resolve(_dirname, 'app/components/base/icons/assets/vender'),
prefix: 'custom-vender',
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The directory name 'vender' appears to be a spelling error - the correct spelling is 'vendor'. While this spelling is used consistently throughout the codebase (as evidenced by the existing directory structure at 'app/components/base/icons/assets/vender'), it's still technically incorrect. Since this is a new configuration being added, it would be a good opportunity to fix the spelling, though doing so would require renaming the directory and updating all references throughout the codebase.

Suggested change
prefix: 'custom-vender',
prefix: 'custom-vendor',

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +35
"lint": "eslint --cache --concurrency=auto",
"lint:ci": "eslint --cache --concurrency 2",
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The concurrency value has been changed from the double-quoted string "auto" to an unquoted value auto, and from 3 to 2 for the CI environment. While the change from quoted to unquoted is fine (both work), the reduction in concurrency for CI from 3 to 2 is not explained in the PR description. This change appears unrelated to the main purpose of introducing CSS icons and should either be explained or reverted.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💪 enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor/Chore] Introduce CSS icons

1 participant