Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add custom css file to Sphinx?

How can I add a custom css file? The following config does not work:

# conf.py html_static_path = ['_static'] html_theme = 'default' html_theme_options = {   'cssfiles': ['_static/style.css'] } 

Result:

C:\temp\test-docs\docs>make html Running Sphinx v1.2.2 loading pickled environment... not yet created building [html]: targets for 2 source files that are out of date updating environment: 2 added, 0 changed, 0 removed reading sources... [ 50%] help reading sources... [100%] index  looking for now-outdated files... none found pickling environment... done checking consistency... done preparing documents... Theme error: unsupported theme option 'cssfiles' given 
like image 702
ole Avatar asked May 04 '14 22:05

ole


People also ask

How do you customize the Sphinx theme?

Custom CSS stylesheet is the most common way how to modify the existing Sphinx theme. You will create custom CSS that will be placed as <link rel="stylesheet"> after theme's main CSS giving you the opportunity to overwrite styles you don't like. Create custom.

How do I enable custom CSS?

The Custom CSS Editor allows you to customize the appearance of your theme without the need to create a child theme or worry about theme updates overwriting your customizations. To enable this feature, visit Jetpack → Settings → Writing in your site's dashboard.

How do I fix custom CSS not working?

Regenerating CSS: This can easily be fixed by going to WP admin > Elementor > Tools > Regenerate CSS. Then, you can clear the cache (WP cache and browser cache) and refresh the page. Clearing Site Cache: Check if you have any caching plugins on your site or any server level caching enabled. Clear those caches.


1 Answers

A simpler way is to add this to your conf.py:

def setup(app):     app.add_css_file('css/custom.css')  # may also be an URL 

Then put the file into the _static/css/ folder.

like image 123
Gringo Suave Avatar answered Oct 10 '22 04:10

Gringo Suave