diff --git a/buildSrc/src/main/groovy/javadoc-defaults.gradle b/buildSrc/src/main/groovy/javadoc-defaults.gradle index d66dc47c3..43be94310 100644 --- a/buildSrc/src/main/groovy/javadoc-defaults.gradle +++ b/buildSrc/src/main/groovy/javadoc-defaults.gradle @@ -28,6 +28,9 @@ tasks.withType(Javadoc).configureEach { options.header = """${engineName} 🎮 API""" options.bottom = """
Copyright © ${copyrightText}. Released under the ${mitName} License.
""" + options.noDeprecatedList = true + options.noHelp = true + if (themeCss.exists()) { options.addStringOption("-add-stylesheet", themeCss.absolutePath) } @@ -49,6 +52,14 @@ tasks.withType(Javadoc).configureEach { // Generation-time HTML adjustments (Favicons, Fonts, SEO/GEO metadata, Bottom Tags, and Footer) if (destinationDir && destinationDir.exists()) { + // Optimize stylesheet.css by stripping unused @import url('fonts/dejavu.css'); + def stylesheetFile = new File(destinationDir, 'resource-files/stylesheet.css') + if (stylesheetFile.exists()) { + def css = stylesheetFile.getText('UTF-8') + css = css.replace("@import url('fonts/dejavu.css');", "/* dejavu.css omitted */") + stylesheetFile.setText(css, 'UTF-8') + } + destinationDir.eachFileRecurse(groovy.io.FileType.FILES) { file -> if (file.name.endsWith(".html")) { enhanceJavadocHtml(file, destinationDir) @@ -65,12 +76,31 @@ void enhanceJavadocHtml(File file, File rootDir) { def html = file.getText("UTF-8") if (html.contains("")) return - // 1. Favicons & Fonts in - def headAdditions = """ + // 1. Early Head Injections (Theme script & Critical font variables at the very top of before any CSS/scripts) + def earlyHead = """ - - - + + """ + html = html.replaceFirst("", earlyHead) + + // 2. Metadata & Favicons in + def headAdditions = """ @@ -102,6 +132,119 @@ void enhanceJavadocHtml(File file, File rootDir) { html = html.replace("", headAdditions + "\n") } + // 2. Generation-Time 2-Level Header (Eliminates DOM delay on large pages like index-all.html) + def navMatcher = (html =~ /(?s)(