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:
148148 # Determine the full path to the dist css file
149149 if not (dist_css_base := getattr (settings , "TAILWIND_CLI_DIST_CSS" , "css/tailwind.css" )):
150150 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
152157
153158 # Determine the full path to the source css file.
154159 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):
110110 get_config ()
111111
112112
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+
113131def test_invalid_settings_for_tailwind_cli_dist_css (settings : SettingsWrapper ):
114132 settings .TAILWIND_CLI_DIST_CSS = None
115133 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