@@ -101,28 +101,30 @@ def get_theme_option_var(self, name, default):
101101 def _resolve_scss_folder (self ):
102102 """Resolve the SCSS sources folder from the configured theme package.
103103
104- Tries to import the theme module specified by simplepdf_theme and use
105- its get_scss_sources_path() if available. Falls back to the bundled
106- simplepdf_theme if the external theme cannot be found .
104+ Imports the theme module and calls its get_scss_sources_path(). Falls
105+ back to the bundled simplepdf_theme if the theme cannot be imported or
106+ does not define get_scss_sources_path() .
107107 """
108108 theme_name = self .app .config .simplepdf_theme or "simplepdf_theme"
109109 try :
110110 theme_module = importlib .import_module (theme_name )
111111 if hasattr (theme_module , "get_scss_sources_path" ):
112112 return theme_module .get_scss_sources_path ()
113- return os .path .join (
114- os .path .dirname (theme_module .__file__ ),
115- "static" , "styles" , "sources" ,
113+ logger .warning (
114+ f"Theme '{ theme_name } ' does not define get_scss_sources_path(), "
115+ "falling back to bundled simplepdf_theme" ,
116+ type = "simplepdf" ,
117+ subtype = "theme" ,
116118 )
117119 except ImportError :
118- logger .info (
120+ logger .warning (
119121 f"Could not import theme '{ theme_name } ', "
120- "falling back to bundled simplepdf_theme"
121- )
122- return os .path .join (
123- os .path .dirname (__file__ ), ".." , "themes" ,
124- "simplepdf_theme" , "static" , "styles" , "sources" ,
122+ "falling back to bundled simplepdf_theme" ,
123+ type = "simplepdf" ,
124+ subtype = "theme" ,
125125 )
126+ from sphinx_simplepdf .themes .simplepdf_theme import get_scss_sources_path
127+ return get_scss_sources_path ()
126128
127129 def finish (self ) -> None :
128130 super ().finish ()
0 commit comments