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
Load several css files in theme.conf #10444
Comments
I think that's a great idea! I've also struggled with managing multiple CSS files in my own theme. This also led to awkward instructions for people who want to derive their own theme from mine: https://insipid-sphinx-theme.readthedocs.io/en/0.3.0/customization.html#derive-your-own-theme I think it would be great if we could write something like this in
I don't see why this shouldn't work, for example People who want to derive from an existing theme can just define their whole list of CSS files, and they can decide which files of the original theme they do and don't want to use. What do you think? But until then, this is what I am using as a work-around in {% block css %}
<link rel="stylesheet" type="text/css" href="{{ pathto('_static/my-before-file.css', 1) }}" />
{{- super() }}
<link rel="stylesheet" type="text/css" href="{{ pathto('_static/my-after-file.css', 1) }}" />
{%- endblock %} Would that work for you? |
Yes, the mentioned list is what I am also talking about. That would be a nice improvement and make the code also more straight forward, because you can avoid writing css files at all in the template html files:
I am trying to find out, what super() does in this case. But thanks for the hint. |
+1; Reasonable. |
…es via "stylesheet" setting
Thanks, Sphinx 5.1 will allow specifying multiple stylesheets in A |
Is your feature request related to a problem? Please describe.
We have our own Sphinx theme called otcdocstheme. In this theme we are loading our own (specific) css file: otcdocstheme.css and some unspecific ones like bootstrap.min.css etc. The specific one is mentioned in theme.conf as it should be and the unspecific ones like bootstrap.min.css are loaded in the (layout-) .html files. This leads to the fact that the unspecific css files are loaded after the specific ones and this causes several issues due to the order, for instance overwriting elements (especially with !important flag). We also derive from the theme with some subprojects having their own .conf files which are also loaded after the theme-specific css files, as you can see in the listing below
Describe the solution you'd like
It would like to have the option to specify more than one .css file in the theme.conf section to overcome this issue.
Describe alternatives you've considered
The alternative would be to load the unspecific css files in our specific one like bootstrap.min.css in otcdocstheme.css , but this is somehow strange in my opinion.
The text was updated successfully, but these errors were encountered: