Skip to content

Commit 0a9d376

Browse files
committed
Tweak data image serving for RTD
1 parent f6aaab1 commit 0a9d376

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

docs/source/_static/helper.js

Whitespace-only changes.

docs/source/conf.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,21 @@ def setup(app):
209209
os.chdir(popd)
210210

211211
app.setup_extension('jupyter_sphinx.embed_widgets')
212+
212213
def add_scripts(app):
213214
for fname in ['jupyter-threejs.js']:
214215
if not os.path.exists(os.path.join(here, '_static', fname)):
215216
app.warn('missing javascript file: %s' % fname)
216217
app.add_javascript(fname)
218+
219+
def add_images(app):
220+
# TODO: Add all images automatically by dir
221+
for img_name in ('earth.jpg', 'checkerboard.png'):
222+
img = os.path.join('examples', 'img', img_name)
223+
app.builder.images[img] = img_name
224+
217225
app.connect('builder-inited', add_scripts)
226+
227+
if on_rtd:
228+
# Ensure example image resources are available. This requires a redirect on RTD.
229+
app.connect('builder-inited', add_images)

js/scripts/copy-files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const buildDir = path.resolve(baseDir, 'dist');
1313
const docStaticDir = path.resolve(baseDir, '..', 'docs', 'source', '_static');
1414

1515
const exampleImagesSrcDir = path.resolve(baseDir, '..', 'examples', 'img');
16-
const exampleImagesDstDir = path.resolve(docStaticDir, 'examples', 'img');
16+
const exampleImagesDstDir = path.resolve(baseDir, '..', 'docs', 'source', 'examples', 'img');
1717

1818

1919
function copyThree() {

0 commit comments

Comments
 (0)