Skip to content

Commit 544e6b0

Browse files
committed
Use single shared template for both package and standalone script
Move dist/default.php to resources/template.php and have both PhpInfo::render() and the standalone build use it. Eliminates template divergence — standalone now gets copy buttons, anchor links, and all other features from the package template.
1 parent 3b63f39 commit 544e6b0

4 files changed

Lines changed: 12 additions & 303 deletions

File tree

build/build.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
$root = dirname(__DIR__);
1010

1111
$source = file_get_contents(__DIR__ . '/go.php');
12+
$template = file_get_contents($root . '/resources/template.php');
1213
$css = file_get_contents($root . '/dist/styles.css');
1314
$js = file_get_contents($root . '/dist/app.js');
1415

@@ -48,6 +49,13 @@
4849
$source
4950
);
5051

52+
// Inline the template (exit PHP, paste template content, re-enter PHP)
53+
$source = str_replace(
54+
"include __DIR__ . '/../resources/template.php';",
55+
"?>\n" . $template . "\n<?php",
56+
$source
57+
);
58+
5159
// Build the final output: <?php + class blocks + main script in namespace {}
5260
$output = "<?php\n" . $inlined . "namespace {\n\n" . $source . "\n}\n";
5361

0 commit comments

Comments
 (0)