Do not attempt to load stylesheet if stylesheet attribute is missing
As someone with a UI project that contains all UI-related files (search-ui.js, search.css, et al) and merges these together, we'd rather not have any supplemental_ui files for extensions in the playbook project unless strictly necessary.
We'd rather not have the script dynamically add the stylesheet at the moment as it is already included in the UI, and if data-stylesheet
is unset the browser will try to use /undefined
as a stylesheet.
(It could be nice if the extension included everything, but then it would preferably have to be dynamic to the extent that some type of tag or placeholder is replaced during build time by Antora, and all other files are added to the UI.)
<script src="{{{uiRootPath}}}/js/site.js"></script>
<!--- ... -->
{{#if env.SITE_SEARCH_PROVIDER}}
<script src="{{uiRootPath}}/js/vendor/lunr.js"></script>
<script src="{{uiRootPath}}/js/vendor/search-ui.js" id="search-script" data-base-path="{{or siteRootPath (or site.url siteRootUrl)}}" data-page-path="{{@root.page.url}}"></script>
<script async src="{{uiRootPath}}/../search-index.js"></script>
{{/if}}
<!--- ... -->
(FWIW, we've considered mashing site.js
, lunr.js
and search-ui.js
together.)
-
Add additional detail to this issue as I have to get some sleep @thor.k.h