Skip to content
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

Sphinx-design stylesheet is not added to the document head #116

Closed
K20shores opened this issue Dec 13, 2022 · 5 comments
Closed

Sphinx-design stylesheet is not added to the document head #116

K20shores opened this issue Dec 13, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@K20shores
Copy link

K20shores commented Dec 13, 2022

Describe the bug

context
When I added sphinx-design to my docs and built the site, I saw that sphinx-design classes and HTML layouts are applied to the page, but I the css styles are not loaded.

expectation
I expected styles to load.

bug
When I inspect the stylesheets loaded in the documents head, I don't see any reference to a style sheet made by sphinx design (which I think is of the form design-style.hash.min. That stylesheet is located in _build/html/_sphinx_design_static, but there is no reference to this in the document header.

problem
This is a problem for people using sphinx-doc because sphinx-doc does not add any value when it's stylesheet is not added.

This occurs with Python 3.9.15 and these versions of installed sphinx packages

Reproduce the bug

You can reproduce this on a branch in my repository. Note that in docs/source/index.rst there are some directives to create a grid.

git clone https://github.com/NCAR/tuv-x.git                                 
cd tuv-x                                                                    
git checkout 208-write-a-contributors-document                              
conda create --name env                                                     
conda activate env                                                          
cd docs                                                                     
conda install --file requirements.txt --name env -y                         
conda install sphinx-design                                                 
git clone https://github.com/VACUMM/sphinx-fortran.git                      
cd sphinx-fortran                                                           
pip install .                                                               
cd ../                                                                      
make html                                                                   
open _build/html/index.html 

After inspecting the head of that page, you will not find the style file.

List your environment

Package Version Source
pydata-sphinx-theme 0.8.1 pyhd8ed1ab_0 conda-forge
sphinx 4.5.0 pyh6c4a22f_0 conda-forge
sphinx-book-theme 0.3.3 pyhd8ed1ab_0 conda-forge
sphinx-design 0.3.0 pyhd8ed1ab_0 conda-forge
sphinx-fortran 1.1.1 pypi_0 pypi
sphinxcontrib-applehelp 1.0.2 py_0 conda-forge
sphinxcontrib-devhelp 1.0.2 py_0 conda-forge
sphinxcontrib-htmlhelp 2.0.0 pyhd8ed1ab_0 conda-forge
sphinxcontrib-jsmath 1.0.1 py_0 conda-forge
sphinxcontrib-qthelp 1.0.3 py_0 conda-forge
sphinxcontrib-serializinghtml 1.1.5 pyhd8ed1ab_2 conda-forge
@K20shores K20shores added the bug Something isn't working label Dec 13, 2022
@welcome
Copy link

welcome bot commented Dec 13, 2022

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@chrisjsewell
Copy link
Member

You haven't added it to the extensions list

@K20shores
Copy link
Author

K20shores commented Dec 13, 2022

You haven't added it to the extensions list

Perhaps you looked at a commit where I had briefly removed it. But, that is not the case, especially since the html structure generated by sphinx-design was added as could be seen in the inspector. At any rate, this draft PR has the extension added but you can see in the preview of the docs that the style is not applied. If you inspect any of the large pictures on the homepage, you will see that they are in fact in sphinx-design grids, but have no styling because the style document is not linked.

@chrisjsewell
Copy link
Member

Heya, yeh I'm not sure why this is added: https://github.com/NCAR/tuv-x/blob/1a2e9b86054f418397f24f32a2e24d59572d0fa4/docs/source/conf.py#L79-L82

but this is not the way to add custom css, as you are overriding sphinx's internal logic, its with https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_css_files

@K20shores
Copy link
Author

Oh, thank you for catching that. That fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants