@@ -267,23 +267,27 @@ def jupyterlite_build(app: Sphinx, error):
267267 if app .env .config .jupyterlite_config :
268268 config = ["--config" , app .env .config .jupyterlite_config ]
269269
270- with tempfile .TemporaryDirectory () as tmp_dir :
271- subprocess .run (
272- [
273- "jupyter" ,
274- "lite" ,
275- "build" ,
276- "--debug" ,
277- * config ,
278- "--lite-dir" ,
279- tmp_dir ,
280- "--contents" ,
281- os .path .join (app .srcdir , CONTENT_DIR ),
282- "--output-dir" ,
283- os .path .join (app .outdir , JUPYTERLITE_DIR ),
284- ],
285- check = True ,
286- )
270+ command = [
271+ "jupyter" ,
272+ "lite" ,
273+ "build" ,
274+ "--debug" ,
275+ * config ,
276+ "--contents" ,
277+ os .path .join (app .srcdir , CONTENT_DIR ),
278+ "--output-dir" ,
279+ os .path .join (app .outdir , JUPYTERLITE_DIR ),
280+ ]
281+
282+ if app .env .config .jupyterlite_dir :
283+ command .extend (["--lite-dir" , app .env .config .jupyterlite_dir ])
284+
285+ subprocess .run (command , check = True )
286+ else :
287+ with tempfile .TemporaryDirectory () as tmp_dir :
288+ command .extend (["--lite-dir" , tmp_dir ])
289+
290+ subprocess .run (command , check = True )
287291
288292 print ("[jupyterlite-sphinx] JupyterLite build done" )
289293
@@ -305,6 +309,7 @@ def setup(app):
305309
306310 # Config options
307311 app .add_config_value ("jupyterlite_config" , None , rebuild = "html" )
312+ app .add_config_value ("jupyterlite_dir" , None , rebuild = "html" )
308313
309314 # Initialize RetroLite and JupyterLite directives
310315 app .add_node (
0 commit comments