Skip to content

Commit

Permalink
do not remove JS added by Sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
basnijholt committed Mar 20, 2019
1 parent f57a4ff commit 8aa7cd2
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,28 +136,17 @@ def get_holoviews_js_css():
from holoviews.plotting import Renderer
dependencies = {**Renderer.core_dependencies,
**Renderer.extra_dependencies}
required = ['jQuery', 'jQueryUI', 'underscore', 'require']
required = ['jQueryUI'] # require, jQuery, and underscore are added by sphinx
js = [url for name in required for url in dependencies[name].get('js', [])]
css = [url for name in required for url in dependencies[name].get('css', [])]
return js, css


js, css = get_holoviews_js_css()
html_context = {'holoviews_js_files': js}


def remove_jquery_and_underscore(app):
# We need to remove the jquery and underscore file that are
# added by default because we already add it in the <head> tag.
remove = lambda x: not any(js in x for js in ['jquery', 'underscore'])
if hasattr(app.builder, 'script_files'):
app.builder.script_files = [x for x in app.builder.script_files
if remove(x)]
html_context = {'holoviews_js_files': js} # used in source/_templates/layout.html


def setup(app):
for url in css:
app.add_stylesheet(url)

app.add_stylesheet('custom.css') # For the `live_info` widget
app.connect('builder-inited', remove_jquery_and_underscore)

0 comments on commit 8aa7cd2

Please sign in to comment.