debug config also drives Twig debug + bypasses static cache
When debug is true: enable Twig debug mode (dump(), auto_reload, DebugExtension), and stop caching sidecar-less pages — Renderer skips the cache write, the dev router skips serving cache files, and bootstrap clears stale cache on the first request that reaches PHP. Also update docs: new Debug mode section on the config page, cache- opt-out notes (debug + empty index.php sidecar) on the caching page, and correct the Sass build target to App/css/main.css in AGENTS.md and the styling page. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FZQHKxu24mvojrJDwhWVS
This commit is contained in:
+11
-1
@@ -18,8 +18,18 @@ if ($uri !== '/' && (is_file($file) || is_dir($file))) {
|
||||
return false; // let the built-in server handle real files/dirs (css, cache)
|
||||
}
|
||||
|
||||
// Mirror .htaccess's "serve the pre-rendered static file, bypassing PHP"
|
||||
// rule — but skip it when debug is on, so sidecar-less pages render fresh
|
||||
// on every request (Renderer also stops writing the cache in that mode).
|
||||
$novaconiumConfig = require __DIR__ . '/../novaconium/config.php';
|
||||
$appConfigFile = __DIR__ . '/../App/config.php';
|
||||
$config = is_file($appConfigFile)
|
||||
? array_merge($novaconiumConfig, require $appConfigFile)
|
||||
: $novaconiumConfig;
|
||||
$debug = (bool) $config['debug'];
|
||||
|
||||
$cacheFile = __DIR__ . '/cache' . $uri . '/index.html';
|
||||
if (is_file($cacheFile)) {
|
||||
if (!$debug && is_file($cacheFile)) {
|
||||
readfile($cacheFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user