diff --git a/releasenotes/notes/copy-css-to-static-938b35b03a568abc.yaml b/releasenotes/notes/copy-css-to-static-938b35b03a568abc.yaml new file mode 100644 index 0000000..fc7124f --- /dev/null +++ b/releasenotes/notes/copy-css-to-static-938b35b03a568abc.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Adds a handler to copy the CSS file into the _static directory on build. + Previously the CSS file was not being copied over into the built docs. diff --git a/sphinx_feature_classification/support_matrix.py b/sphinx_feature_classification/support_matrix.py index 0d4c8b4..02e4997 100644 --- a/sphinx_feature_classification/support_matrix.py +++ b/sphinx_feature_classification/support_matrix.py @@ -19,7 +19,9 @@ It is used via a single directive in the .rst file """ +from os import path import re +import shutil from docutils import nodes from docutils.parsers import rst @@ -463,6 +465,15 @@ class Directive(rst.Directive): return para +def on_build_finished(app, exc): + if exc is None: + src = path.join(path.abspath(path.dirname(__file__)), + 'support-matrix.css') + dst = path.join(app.outdir, '_static', 'support-matrix.css') + shutil.copyfile(src, dst) + + def setup(app): app.add_directive('support_matrix', Directive) app.add_css_file('support-matrix.css') + app.connect('build-finished', on_build_finished)