Skip to content

Commit

Permalink
* Fix css_files breakage from Sphinx 1.6+ update.
Browse files Browse the repository at this point in the history
  `#158 <https://github.com/ryan-roemer/sphinx-bootstrap-theme/pull/158>`_,
  `#160 <https://github.com/ryan-roemer/sphinx-bootstrap-theme/pull/160>`_.

* **Breaking Change**: Remove ``bootswatch_css_custom`` override, and instead opt for documenting idiomatic Sphinx-version specific generic overrides for custom CSS.
  • Loading branch information
ryan-roemer committed May 17, 2017
1 parent 11c608e commit 0ecb183
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 18 deletions.
8 changes: 8 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
History
=========

Unreleased
==========
* Fix `css_files` breakage from Sphinx `1.6+` update.
`#158 <https://github.com/ryan-roemer/sphinx-bootstrap-theme/pull/158>`_,
`#160 <https://github.com/ryan-roemer/sphinx-bootstrap-theme/pull/160>`_.

* **Breaking Change**: Remove ``bootswatch_css_custom`` override, and instead opt for documenting idiomatic Sphinx-version specific generic overrides for custom CSS.

v0.4.14
=======
* Fix visibiliy of multiple footnote references. (`@drewhutchison`_)
Expand Down
27 changes: 20 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,26 +204,39 @@ file to override a style, which in the demo would be something like::
$ mkdir source/_static
$ touch source/_static/my-styles.css

In the new file "source/_static/my-styles.css", add any appropriate styling,
e.g. a bold background color::

footer {
background-color: red;
}

Then, in "conf.py", edit this line::

html_static_path = ["_static"]

You will also need the override template "source/_templates/layout.html" file
From there it depends on which version of Sphinx you are using:

**Sphinx <= 1.5**

You will need the override template "source/_templates/layout.html" file
configured as above, but with the following code::

{# Import the theme's layout. #}
{% extends "!layout.html" %}

{# Custom CSS overrides #}
{% set bootswatch_css_custom = ['my-styles.css'] %}
{% set css_files = css_files + ['_static/my-styles.css'] %}

Then, in the new file "source/_static/my-styles.css", add any appropriate
styling, e.g. a bold background color::
**Sphinx >= 1.6**

footer {
background-color: red;
}
Add a `setup` function in "conf.py" with stylesheet paths added relative to the
static path::

def setup(app):
app.add_stylesheet("my-styles.css") # also can be a full URL
# app.add_stylesheet("ANOTHER.css")
# app.add_stylesheet("AND_ANOTHER.css")

Theme Notes
===========
Expand Down
5 changes: 0 additions & 5 deletions demo/source/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{% extends "!layout.html" %}

{# Custom CSS overrides #}
{# set bootswatch_css_custom = ['_static/my-styles.css'] #}

{# Add github banner (from: https://github.com/blog/273-github-ribbons). #}
{% block header %}
{{ super() }}
Expand All @@ -20,5 +17,3 @@
});
</script>
{% endblock %}


3 changes: 3 additions & 0 deletions demo/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@
# Output file base name for HTML help builder.
htmlhelp_basename = 'MyProjectDoc'

# # Custom style overrides
# def setup(app):
# app.add_stylesheet('my-styles.css') # may also be an URL

# -- Options for LaTeX output --------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@
@import url("{{ 'bootstrap-' + bootstrap_version + '/css/bootstrap-' + bootstrap_additional_css + '.min.css' }}");
{% endif %}

{% if bootswatch_css_custom %}
{%- for css_custom in bootswatch_css_custom %}
@import url("{{ css_custom }}");
{%- endfor %}
{% endif %}

/*
* Styles
*/
Expand Down

0 comments on commit 0ecb183

Please sign in to comment.