sphinx-needs
sphinx-needs copied to clipboard
Add sphinx-needs specific .css and .js only on html pages where necessary
Currently, the sphinx-needs specific .css and .js files (datatables.min.css/js, common.css, layouts.css , etc.) are added to every .html file globally, disregarding whether needed or not. For performance reasons (especially the big datatables.min.js), this should be changed to a selective additon only to the necessary htmls.
This can be realized by using the html-page-context event, which is called by the builder after each build of a html page. The css/js can be added via context['css_files'].append("_static/sphinx-needs/....css"), context['script_files'].append("_static/sphinx-needs/....js") each time.
@danwos I already tested this quickly and think it would work.
This is also loosly related to #455