Skip to content

Commit 6cdd24e

Browse files
committed
remove the jquery and underscore that is added by sphinx
Closes #118
1 parent a9f6349 commit 6cdd24e

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

docs/source/_static/jquery.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/source/conf.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
'sphinx.ext.napoleon',
5151
'jupyter_sphinx.execute',
5252
'sphinx_fontawesome',
53-
'm2r'
53+
'm2r',
5454
]
5555

5656
source_parsers = {}
@@ -136,7 +136,7 @@ def get_holoviews_js_css():
136136
from holoviews.plotting import Renderer
137137
dependencies = {**Renderer.core_dependencies,
138138
**Renderer.extra_dependencies}
139-
required = ['jQuery', 'jQueryUI', 'require']
139+
required = ['jQuery', 'jQueryUI', 'underscore', 'require']
140140
js = [url for name in required for url in dependencies[name].get('js', [])]
141141
css = [url for name in required for url in dependencies[name].get('css', [])]
142142
return js, css
@@ -146,9 +146,18 @@ def get_holoviews_js_css():
146146
html_context = {'holoviews_js_files': js}
147147

148148

149+
def remove_jquery_and_underscore(app):
150+
# We need to remove the jquery and underscore file that are
151+
# added by default because we already add it in the <head> tag.
152+
remove = lambda x: not any(js in x for js in ['jquery', 'underscore'])
153+
if hasattr(app.builder, 'script_files'):
154+
app.builder.script_files = [x for x in app.builder.script_files
155+
if remove(x)]
156+
157+
149158
def setup(app):
150159
for url in css:
151160
app.add_stylesheet(url)
152161

153162
app.add_stylesheet('custom.css') # For the `live_info` widget
154-
app.add_javascript("https://unpkg.com/@jupyter-widgets/[email protected]/dist/embed-amd.js")
163+
app.connect('builder-inited', remove_jquery_and_underscore)

0 commit comments

Comments
 (0)