Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Commit e19546f

Browse files
authored
Merge pull request #39 from davidfischer/stop-injecting-theme-css
Stop injecting the theme CSS on the RTD theme
2 parents ffc887c + a348563 commit e19546f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

prospector.yml

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ pylint:
1515
options:
1616
dummy-variables-rgx: '_$|__$|dummy'
1717
max-line-length: 100
18+
# https://github.com/PyCQA/pylint/issues/73
19+
ignored-modules: distutils
1820
disable:
1921
- logging-format-interpolation
2022

readthedocs_ext/readthedocs.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import os
77
import re
88
import types
9+
from distutils.version import LooseVersion
910

1011
import sphinx
1112
from sphinx import package_dir
@@ -68,7 +69,18 @@ def update_body(app, pagename, templatename, context, doctree):
6869
# Only insert on our HTML builds
6970
return
7071

71-
if theme_css not in app.builder.css_files:
72+
inject_css = True
73+
74+
# Starting at v0.4.0 of the sphinx theme, the theme CSS should not be injected
75+
# This decouples the theme CSS (which is versioned independently) from readthedocs.org
76+
if theme_css.endswith('sphinx_rtd_theme.css'):
77+
try:
78+
import sphinx_rtd_theme
79+
inject_css = LooseVersion(sphinx_rtd_theme.__version__) < LooseVersion('0.4.0')
80+
except ImportError:
81+
pass
82+
83+
if inject_css and theme_css not in app.builder.css_files:
7284
app.builder.css_files.insert(0, theme_css)
7385

7486
# This is monkey patched on the signal because we can't know what the user

0 commit comments

Comments
 (0)