Skip to content

Commit d869daa

Browse files
committed
Copy CSS and SVG files earlier
1 parent cc292c8 commit d869daa

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

src/nbsphinx/__init__.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,23 @@ def builder_inited(app):
16371637
os.path.join(os.path.dirname(__file__), '_texinputs'),
16381638
os.path.join(app.builder.outdir))
16391639

1640+
if app.builder.format == 'html':
1641+
context = {
1642+
'nbsphinx_responsive_width': app.config.nbsphinx_responsive_width,
1643+
'nbsphinx_prompt_width': app.config.nbsphinx_prompt_width,
1644+
}
1645+
assets = (
1646+
'nbsphinx-code-cells.css_t',
1647+
'nbsphinx-gallery.css',
1648+
'nbsphinx-no-thumbnail.svg',
1649+
'nbsphinx-broken-thumbnail.svg',
1650+
)
1651+
for a in assets:
1652+
sphinx.util.fileutil.copy_asset(
1653+
os.path.join(os.path.dirname(__file__), '_static', a),
1654+
os.path.join(app.builder.outdir, '_static'),
1655+
context=context)
1656+
16401657

16411658
def env_merge_info(app, env, docnames, other):
16421659
env.nbsphinx_notebooks.update(other.nbsphinx_notebooks)
@@ -1693,22 +1710,6 @@ def html_collect_pages(app):
16931710
sphinx.util.copyfile(
16941711
os.path.join(app.env.nbsphinx_auxdir, notebook),
16951712
os.path.join(app.builder.outdir, notebook))
1696-
1697-
context = {
1698-
'nbsphinx_responsive_width': app.config.nbsphinx_responsive_width,
1699-
'nbsphinx_prompt_width': app.config.nbsphinx_prompt_width,
1700-
}
1701-
assets = (
1702-
'nbsphinx-code-cells.css_t',
1703-
'nbsphinx-gallery.css',
1704-
'nbsphinx-no-thumbnail.svg',
1705-
'nbsphinx-broken-thumbnail.svg',
1706-
)
1707-
for a in assets:
1708-
sphinx.util.fileutil.copy_asset(
1709-
os.path.join(os.path.dirname(__file__), '_static', a),
1710-
os.path.join(app.builder.outdir, '_static'),
1711-
context=context)
17121713
return [] # No new HTML pages are created
17131714

17141715
def env_updated(app, env):

0 commit comments

Comments
 (0)