Skip to content

Share Tailwind v3/v4 plugin code in shared_tailwind - #7574

Open
quotentiroler wants to merge 2 commits into
reflex-dev:mainfrom
quotentiroler:refactor/share-tailwind-plugin-code
Open

quotentiroler wants to merge 2 commits into
reflex-dev:mainfrom
quotentiroler:refactor/share-tailwind-plugin-code

Conversation

@quotentiroler

@quotentiroler quotentiroler commented Oct 15, 2026 •

Copy link
Copy Markdown

Type of change

Internal refactor, no behavior change.

tailwind_v3.py and tailwind_v4.py carried identical copies of compile_config, add_tailwind_to_css_file, _index_of_element_that_has, pre_compile, get_frontend_development_dependencies and four of their six Constants. AGENTS.md asks to extract duplicated code into parameterized helpers, so these now live once in shared_tailwind:

  • TailwindConstants holds the shared constants. Each version's Constants subclasses it and adds VERSION and ROOT_STYLE_CONTENT.
  • TailwindPlugin implements pre_compile and the dependency list. A version plugin supplies only its root style, its postcss rewrite and its packages.
  • The v4 plugin pinned tailwindcss@4.3.0 and @tailwindcss/postcss@4.3.0 as two literals that were always bumped together. Both now come from one version string.

Verification:

  • Generated output is byte-identical to main for both versions: config, root style with and without Radix, postcss and css rewrites, dependency lists.
  • Module-level names (compile_config, compile_root_style, add_tailwind_to_css_file, add_tailwind_to_postcss_config, Constants) stay importable from tailwind_v3 and tailwind_v4.
  • Adds a test that each plugin wires its own root-style and postcss tasks and pins its packages to a single version.
  • ruff, pyright, ty and the pre-commit hooks pass.

Includes a misc news fragment for reflex-base.

  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

View guided diff

tailwind_v3.py and tailwind_v4.py duplicated compile_config,
add_tailwind_to_css_file, _index_of_element_that_has, pre_compile,
get_frontend_development_dependencies and four of the six Constants.
These now live once in shared_tailwind: TailwindConstants holds the
common constants, TailwindPlugin implements pre_compile and the
dependency list, and each version plugin only supplies its root style,
its postcss rewrite and its packages.

The v4 plugin pinned tailwindcss and @tailwindcss/postcss as two
separate literals that were always bumped together; both now derive
from one version string.

Generated output is byte-identical to main (config, root style with
and without Radix, postcss and css rewrites, dependency lists for both
versions). Module-level names stay importable from tailwind_v3 and
tailwind_v4. Adds a test that each plugin wires its own root-style and
postcss tasks and pins its packages to one version.
@quotentiroler
quotentiroler requested a review from a team as a code owner October 15, 2026 08:28

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 5 files

Reply to a comment to ask cubic a question or push back. It learns from your replies.

View guided diff | Re-trigger cubic

Comment thread packages/reflex-base/src/reflex_base/plugins/tailwind_v3.py
@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Moves common Tailwind constants, file helpers, dependency lists, and compile tasks into shared_tailwind.

  • Tailwind v3 and v4 use one shared plugin setup.
  • Tailwind v4 keeps its PostCSS package on Tailwind's version.

No actionable new issues or mounted-rule violations were found. No previous review threads were supplied. Tests were not run during this review.

Reviews (2) · Last reviewed commit: "Keep TailwindConfig, TailwindPlugin and ..." · Reviewed by Greptile

…version modules

Before the refactor these names were imported into tailwind_v3 and
tailwind_v4, so `from reflex_base.plugins.tailwind_v3 import
TailwindConfig` worked. Re-import them and list them in __all__, with a
test that pins the public names of both modules.

This branch has not been deployed

No deployments
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