Skip to content

Commit

Permalink
Ensure JS on RTD
Browse files Browse the repository at this point in the history
  • Loading branch information
vidartf committed Sep 19, 2019
1 parent e30f7a2 commit d3c4761
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,15 @@


def setup(app):
if on_rtd and not os.path.exists(
os.path.join(here, '_static', 'embed-bundle.js'
)):
# We don't have a develop install on RTD, ensure we get build output:
from subprocess import check_call
cwd = os.path.join(here, '..', '..', 'js')
check_call(['npm', 'install'], cwd=cwd)
check_call(['npm', 'run', 'build'], cwd=cwd)

def add_scripts(app):
for fname in ["helper.js", "embed-bundle.js"]:
if not os.path.exists(os.path.join(here, "_static", fname)):
Expand Down
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
]


if os.environ.get("READTHEDOCS", None) == "True":
# On RTD, skip JS build to save resources
import jupyter_packaging
jupyter_packaging.skip_npm = True

cmdclass = create_cmdclass(
"jsdeps", package_data_spec=package_data_spec, data_files_spec=data_files_spec
)
Expand Down

0 comments on commit d3c4761

Please sign in to comment.