问题
Using Sphinx, one can include static files in the _static folder of the build output. How could I copy a static file to the root of the build folder?
Background: I'm hosting the output of a Sphinx project in Azure App Services, and because of a mp4 video in a few pages, I need a "web.config" file with the following entry:
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>
I need Sphinx to include the web.config in the root of the build folder.
回答1:
Use html_extra_path. This is a configuration option that will copy the list of files given to the html build directory:
html_extra_path = ['path/to/web.config']
来源:https://stackoverflow.com/questions/53282461/how-to-output-a-custom-static-file-in-sphinx