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
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With