@@ -31,10 +31,10 @@ const staticPath = resolve(__dirname, "src/pydata_sphinx_theme/theme/pydata_sphi
3131 */
3232
3333function stylesheet ( css ) { return `<link href="{{ pathto('_static/${ css } ', 1) }}?digest=${ this . hash } " rel="stylesheet" />` ; }
34- function preload ( js ) { return `<link rel="preload" as="script" href="{{ pathto('_static/${ js } ', 1) }}?digest=${ this . hash } " />` ; }
35- function script ( js ) { return `<script defer src="{{ pathto('_static/${ js } ', 1) }}?digest=${ this . hash } "></script>` ; }
34+ function preloadScript ( js ) { return `<link rel="preload" as="script" href="{{ pathto('_static/${ js } ', 1) }}?digest=${ this . hash } " />` ; }
35+ function deferScript ( js ) { return `<script defer src="{{ pathto('_static/${ js } ', 1) }}?digest=${ this . hash } "></script>` ; }
3636// Adding FA without preloading
37- function fascript ( js ) { return `<script src="{{ pathto('_static/${ js } ', 1) }}?digest=${ this . hash } "></script>` ; }
37+ function script ( js ) { return `<script src="{{ pathto('_static/${ js } ', 1) }}?digest=${ this . hash } "></script>` ; }
3838
3939/*******************************************************************************
4040 * the assets to load in the macro
@@ -71,15 +71,15 @@ function macroTemplate({ compilation }) {
7171 {% endmacro %}
7272
7373 {% macro head_js_preload() %}
74- <!-- So that users can add custom icons -->
75- ${ fa_scripts . map ( fascript . bind ( compilation ) ) . join ( "\n" ) }
76- <!-- Pre-loaded scripts that we'll load fully later -->
77- ${ theme_scripts . map ( preload . bind ( compilation ) ) . join ( "\n" ) }
74+ <!-- So that users can add custom icons -->
75+ ${ fa_scripts . map ( script . bind ( compilation ) ) . join ( "\n" ) }
76+ <!-- Pre-loaded scripts that we'll load fully later -->
77+ ${ theme_scripts . map ( preloadScript . bind ( compilation ) ) . join ( "\n" ) }
7878 {% endmacro %}
7979
8080 {% macro body_post() %}
8181 <!-- Scripts loaded after <body> so the DOM is not blocked -->
82- ${ theme_scripts . map ( script . bind ( compilation ) ) . join ( "\n" ) }
82+ ${ theme_scripts . map ( deferScript . bind ( compilation ) ) . join ( "\n" ) }
8383 {% endmacro %}
8484 ` ) ;
8585}
0 commit comments