Skip to content

Commit 11c8b2f

Browse files
committed
fix the test
1 parent 5f37c34 commit 11c8b2f

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

reflex/plugins/tailwind_v3.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ def add_tailwind_to_postcss_config():
161161

162162
postcss_file_lines = postcss_file.read_text().splitlines()
163163

164+
if any(line.strip().startswith("tailwindcss") for line in postcss_file_lines):
165+
return
166+
164167
line_with_postcss_plugins = next(
165168
(
166169
i
@@ -176,7 +179,18 @@ def add_tailwind_to_postcss_config():
176179
)
177180
return
178181

179-
postcss_file_lines.insert(line_with_postcss_plugins + 1, "tailwindcss: {},")
182+
postcss_import_line = next(
183+
(
184+
i
185+
for i, line in enumerate(postcss_file_lines)
186+
if line.strip().startswith('"postcss-import"')
187+
),
188+
None,
189+
)
190+
191+
postcss_file_lines.insert(
192+
(postcss_import_line or line_with_postcss_plugins) + 1, "tailwindcss: {},"
193+
)
180194

181195
return str(postcss_file), "\n".join(postcss_file_lines)
182196

tests/integration/test_tailwind.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def index():
5050
if tailwind_disabled:
5151
config = rx.config.get_config()
5252
config.tailwind = None
53+
config.plugins = []
5354

5455

5556
@pytest.fixture(params=[False, True], ids=["tailwind_enabled", "tailwind_disabled"])

0 commit comments

Comments
 (0)