summaryrefslogtreecommitdiff
path: root/doc/development
diff options
context:
space:
mode:
authorChris Holdgraf <choldgraf@berkeley.edu>2020-07-23 17:39:20 -0700
committerStephen Finucane <stephenfinucane@hotmail.com>2020-07-29 10:38:18 +0100
commit84f7dffd995fa36f5380e4b79a681c62fd3a0296 (patch)
tree238203634365f82d3935b1f022b1b9f44dcc380f /doc/development
parentc7085162d133bc6e1647b063995ddfb9f909b2dc (diff)
downloadsphinx-git-84f7dffd995fa36f5380e4b79a681c62fd3a0296.tar.gz
comments
Diffstat (limited to 'doc/development')
-rw-r--r--doc/development/theming.rst20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/development/theming.rst b/doc/development/theming.rst
index ea993e679..5de10158a 100644
--- a/doc/development/theming.rst
+++ b/doc/development/theming.rst
@@ -245,6 +245,26 @@ Now, you will have access to this function in jinja like so:
</div>
+Add your own static files to the build assets
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you are packaging your own build assets with an extension
+(e.g., a CSS or JavaScript file), you need to ensure that they are placed
+in the ``_static/`` folder of HTML outputs. To do so, you may copy them directly
+into a build's ``_static/`` folder at build time, generally via an event hook.
+Here is some sample code to accomplish this:
+
+.. code-block:: python
+
+ def copy_custom_files(app, exc):
+ if app.builder.format == 'html' and not exc:
+ staticdir = path.join(app.builder.outdir, '_static')
+ copy_asset_file('path/to/myextension/_static/myjsfile.js', staticdir)
+
+ def setup(app):
+ app.connect('builder-inited', copy_custom_files)
+
+
Inject JavaScript based on user configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~