-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reorder CSS files #447
Comments
It seems that I changed this at some point: #144 But that was mainly to ensure that custom css files added by the end user are inserted after our own css (eg with sphinx' |
To insert the theme CSS in the proper location, https://www.sphinx-doc.org/en/master/development/theming.html suggests specifying a single CSS file in theme.conf, and using CSS |
I'll give it a shot |
diff --git a/pydata_sphinx_theme/layout.html b/pydata_sphinx_theme/layout.html
index c9220e02..94610c2d 100644
--- a/pydata_sphinx_theme/layout.html
+++ b/pydata_sphinx_theme/layout.html
@@ -12,7 +12,6 @@
{% endmacro %}
{%- block css %}
- {{ _webpack.head_pre_bootstrap() }}
{{ _webpack.head_pre_icons() }}
{% block fonts %}
{{ _webpack.head_pre_fonts() }}
diff --git a/pydata_sphinx_theme/static/css/theme.css b/pydata_sphinx_theme/static/css/theme.css
index 3f6e79da..7368afdd 100644
--- a/pydata_sphinx_theme/static/css/theme.css
+++ b/pydata_sphinx_theme/static/css/theme.css
@@ -1,3 +1,6 @@
+@import "../basic.css";
+@import "index.2f45af5bc641f38ae0d8d4c41ce8a4b2.css";
+
:root {
/*****************************************************************************
* Theme config
diff --git a/pydata_sphinx_theme/theme.conf b/pydata_sphinx_theme/theme.conf
index 60f48f73..4f736d2c 100644
--- a/pydata_sphinx_theme/theme.conf
+++ b/pydata_sphinx_theme/theme.conf
@@ -1,5 +1,6 @@
[theme]
inherit = basic
+stylesheet = css/theme.css
pygments_style = tango
sidebars = search-field.html, sidebar-nav-bs.html, sidebar-ethical-ads.html However since the name of compiled assets contains the hash, I'd also need to apply a pre-commit hook to replace the include in |
I have a very basic confusion. Looking at the CSS ordering at the docs website, I see
Note how the theme files are included first. That is the reason why the theme can't override a bunch of styling in
basic.css
. That, in turn leads to the excessive use of!important
, and further complicates customization.Therefore I wonder if it would be possible to include the theme assets after the sphinx basic assets.
The text was updated successfully, but these errors were encountered: