Skip to content

Commit

Permalink
Merge pull request #9546 from tk0miya/9267_JS_loaded_twice
Browse files Browse the repository at this point in the history
Fix #9267: html theme: CSS and JS files added by theme were loaded twice
  • Loading branch information
tk0miya committed Aug 16, 2021
2 parents 8afe6ed + 3e5729b commit 8fd4373
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -34,6 +34,7 @@ Bugs fixed
* #9481: cpp domain: some warnings contain non-existing filenames
* #9456: html search: abbreation marks are inserted to the search result if
failed to fetch the content of the page
* #9267: html theme: CSS and JS files added by theme were loaded twice

Testing
--------
Expand Down
8 changes: 5 additions & 3 deletions sphinx/builders/html/__init__.py
Expand Up @@ -287,13 +287,14 @@ def init_highlighter(self) -> None:

if dark_style is not None:
self.dark_highlighter = PygmentsBridge('html', dark_style)
self.add_css_file('pygments_dark.css',
media='(prefers-color-scheme: dark)',
id='pygments_dark_css')
self.app.add_css_file('pygments_dark.css',
media='(prefers-color-scheme: dark)',
id='pygments_dark_css')
else:
self.dark_highlighter = None

def init_css_files(self) -> None:
self.css_files = []
self.add_css_file('pygments.css', priority=200)
self.add_css_file(self._get_style_filename(), priority=200)

Expand All @@ -311,6 +312,7 @@ def add_css_file(self, filename: str, **kwargs: Any) -> None:
self.css_files.append(Stylesheet(filename, **kwargs))

def init_js_files(self) -> None:
self.script_files = []
self.add_js_file('documentation_options.js', id="documentation_options",
data_url_root='', priority=200)
self.add_js_file('jquery.js', priority=200)
Expand Down

0 comments on commit 8fd4373

Please sign in to comment.