File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -148,7 +148,12 @@ def get_config() -> Config:
148
148
# Determine the full path to the dist css file
149
149
if not (dist_css_base := getattr (settings , "TAILWIND_CLI_DIST_CSS" , "css/tailwind.css" )):
150
150
raise ValueError ("TAILWIND_CLI_DIST_CSS must not be None." )
151
- dist_css = Path (settings .STATICFILES_DIRS [0 ]) / dist_css_base
151
+
152
+ first_staticfile_dir = settings .STATICFILES_DIRS [0 ]
153
+ if isinstance (first_staticfile_dir , tuple ):
154
+ # Handle prefixed staticfile dir.
155
+ first_staticfile_dir = first_staticfile_dir [1 ]
156
+ dist_css = Path (first_staticfile_dir ) / dist_css_base
152
157
153
158
# Determine the full path to the source css file.
154
159
src_css = getattr (settings , "TAILWIND_CLI_SRC_CSS" , None )
Original file line number Diff line number Diff line change @@ -110,6 +110,24 @@ def test_invalid_settings_for_staticfiles_dirs(settings: SettingsWrapper):
110
110
get_config ()
111
111
112
112
113
+ def test_string_setting_for_staticfiles_dirs (settings : SettingsWrapper ):
114
+ settings .STATICFILES_DIRS = ["path" ]
115
+ c = get_config ()
116
+ assert c .dist_css == Path ("path/css/tailwind.css" )
117
+
118
+
119
+ def test_path_setting_for_staticfiles_dirs (settings : SettingsWrapper ):
120
+ settings .STATICFILES_DIRS = [Path ("path" )]
121
+ c = get_config ()
122
+ assert c .dist_css == Path ("path/css/tailwind.css" )
123
+
124
+
125
+ def test_prefixed_setting_for_staticfiles_dirs (settings : SettingsWrapper ):
126
+ settings .STATICFILES_DIRS = (("prefix" , "path" ),)
127
+ c = get_config ()
128
+ assert c .dist_css == Path ("path/css/tailwind.css" )
129
+
130
+
113
131
def test_invalid_settings_for_tailwind_cli_dist_css (settings : SettingsWrapper ):
114
132
settings .TAILWIND_CLI_DIST_CSS = None
115
133
with pytest .raises (ValueError , match = "TAILWIND_CLI_DIST_CSS must not be None." ):
You can’t perform that action at this time.
0 commit comments