@@ -91,7 +91,7 @@ def tailwind_config_js_template(
9191 Returns:
9292 The Tailwind config template.
9393 """
94- import json
94+ from reflex . utils . format import orjson_dumps
9595
9696 # Extract parameters
9797 plugins = kwargs .get ("plugins" , [])
@@ -113,23 +113,24 @@ def tailwind_config_js_template(
113113
114114 # Generate import statements for destructured imports
115115 import_lines = "\n " .join ([
116- f"import {{ { imp ['name' ]} }} from { json .dumps (imp ['from' ])} ;" for imp in imports
116+ f"import {{ { imp ['name' ]} }} from { orjson_dumps (imp ['from' ])} ;"
117+ for imp in imports
117118 ])
118119
119120 # Generate plugin imports
120121 plugin_imports = []
121122 for i , plugin in enumerate (plugins , 1 ):
122123 if isinstance (plugin , Mapping ) and "call" not in plugin :
123124 plugin_imports .append (
124- f"import plugin{ i } from { json . dumps (plugin ['name' ])} ;"
125+ f"import plugin{ i } from { orjson_dumps (plugin ['name' ])} ;"
125126 )
126127 elif not isinstance (plugin , Mapping ):
127- plugin_imports .append (f"import plugin{ i } from { json . dumps (plugin )} ;" )
128+ plugin_imports .append (f"import plugin{ i } from { orjson_dumps (plugin )} ;" )
128129
129130 plugin_imports_lines = "\n " .join (plugin_imports )
130131
131132 presets_imports_lines = "\n " .join ([
132- f"import preset{ i } from { json . dumps (preset )} ;"
133+ f"import preset{ i } from { orjson_dumps (preset )} ;"
133134 for i , preset in enumerate (presets , 1 )
134135 ])
135136
@@ -139,7 +140,7 @@ def tailwind_config_js_template(
139140 if isinstance (plugin , Mapping ) and "call" in plugin :
140141 args_part = ""
141142 if "args" in plugin :
142- args_part = json . dumps (plugin ["args" ])
143+ args_part = orjson_dumps (plugin ["args" ])
143144 plugin_list .append (f"{ plugin ['call' ]} ({ args_part } )" )
144145 else :
145146 plugin_list .append (f"plugin{ i } " )
@@ -154,13 +155,13 @@ def tailwind_config_js_template(
154155{ presets_imports_lines }
155156
156157export default {{
157- content: { json . dumps (content or default_content )} ,
158- theme: { json . dumps (theme or {})} ,
159- { f"darkMode: { json . dumps (dark_mode )} ," if dark_mode is not None else "" }
160- { f"corePlugins: { json . dumps (core_plugins )} ," if core_plugins is not None else "" }
161- { f"importants: { json . dumps (important )} ," if important is not None else "" }
162- { f"prefix: { json . dumps (prefix )} ," if prefix is not None else "" }
163- { f"separator: { json . dumps (separator )} ," if separator is not None else "" }
158+ content: { orjson_dumps (content or default_content )} ,
159+ theme: { orjson_dumps (theme or {})} ,
160+ { f"darkMode: { orjson_dumps (dark_mode )} ," if dark_mode is not None else "" }
161+ { f"corePlugins: { orjson_dumps (core_plugins )} ," if core_plugins is not None else "" }
162+ { f"importants: { orjson_dumps (important )} ," if important is not None else "" }
163+ { f"prefix: { orjson_dumps (prefix )} ," if prefix is not None else "" }
164+ { f"separator: { orjson_dumps (separator )} ," if separator is not None else "" }
164165 { f"presets: [{ ', ' .join (f'preset{ i } ' for i in range (1 , len (presets ) + 1 ))} ]," if presets else "" }
165166 plugins: [{ plugin_use_str } ]
166167}};
0 commit comments