diff --git a/_debug_replacements.php b/_debug_replacements.php index 520a5ad..190dfbe 100644 --- a/_debug_replacements.php +++ b/_debug_replacements.php @@ -8,7 +8,6 @@ $vers = '???'; $versfn = __DIR__ . '/../user/version.h'; -$myHash = shell_exec('git rev-parse --short HEAD'); $fwHash = '00000000'; if (file_exists($versfn)) { $f = file_get_contents($versfn); @@ -64,7 +63,7 @@ return [ 'githubrepo' => 'https://github.com/espterm/espterm-firmware', 'githubrepo_front' => 'https://github.com/espterm/espterm-front-end', 'hash_backend' => $fwHash, - 'hash_frontend' => $myHash, // TODO actual versions? + 'hash_frontend' => GIT_HASH, // TODO actual versions? 'ap_dhcp_time' => '120', 'ap_dhcp_start' => '192.168.4.100', diff --git a/base.php b/base.php index 717365d..7308e34 100644 --- a/base.php +++ b/base.php @@ -16,6 +16,8 @@ if (!file_exists(__DIR__ . '/_env.php')) { die("Copy _env.php.example to _env.php and check the settings inside!"); } +define('GIT_HASH', trim(shell_exec('git rev-parse --short HEAD'))); + require_once __DIR__ . '/_env.php'; $prod = defined('STDIN'); diff --git a/build.sh b/build.sh index 5bba76b..7f10082 100755 --- a/build.sh +++ b/build.sh @@ -2,6 +2,8 @@ cd $(dirname $0) +FRONT_END_HASH=$(git rev-parse --short HEAD) + rm -r out/* mkdir out/js mkdir out/css @@ -10,7 +12,7 @@ echo 'Generating lang.js...' php ./dump_js_lang.php echo 'Packing JS...' -npm run babel -- -o out/js/app.js --source-maps js/lib \ +npm run babel -- -o "out/js/app.$FRONT_END_HASH.js" --source-maps js/lib \ js/lib/chibi.js \ js/lib/keymaster.js \ js/lib/polyfills.js \ @@ -27,7 +29,7 @@ npm run babel -- -o out/js/app.js --source-maps js/lib \ echo 'Building CSS...' -npm run sass -- --output-style compressed sass/app.scss out/css/app.css +npm run sass -- --output-style compressed sass/app.scss "out/css/app.$FRONT_END_HASH.css" echo 'Building HTML...' diff --git a/pages/_head.php b/pages/_head.php index 3a39b02..c8e5098 100644 --- a/pages/_head.php +++ b/pages/_head.php @@ -5,8 +5,8 @@ <?= $_GET['PAGE_TITLE'] ?> - - + +