euchre-live

Euchre web-app for the socially distant family
git clone git://git.alexkarle.com/euchre-live.git
Log | Files | Refs | README | LICENSE

commit ba7a89ef6794f4dc9415f31d87f8da6d00a7590d (patch)
parent 63f7c32876dcea2cce61558c436c022fc9cef031
Author: Alex Karle <alex@karle.co>
Date:   Tue, 26 May 2020 18:47:21 -0400

gloat: Default to preprod (non-minified) JS, use prod in prod

This commit updates gloat.pl to by default use preprod.html and only
when MOJO_MODE=production use index.html, which uses the minified
javascript. It also updates the restart.sh script to set the variable
accordingly so that we send over the smaller bundle in production.

Diffstat:
Mbin/restart.sh | 4+++-
Mgloat.pl | 6+++++-
Mpublic/index.html | 12++++++------
3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/bin/restart.sh b/bin/restart.sh @@ -24,7 +24,9 @@ restart() { fi if [ $name = "preprod" ]; then - export PREPROD=1 + export MOJO_MODE=development + else + export MOJO_MODE=production fi printf "%s" "Starting new server... " diff --git a/gloat.pl b/gloat.pl @@ -15,7 +15,11 @@ plugin Webpack => {process => [qw(js css sass)]}; get '/' => sub { my $c = shift; - $c->reply->static($ENV{PREPROD} ? 'preprod.html' : 'index.html'); + if ($ENV{MOJO_MODE} && $ENV{MOJO_MODE} eq 'production') { + $c->reply->static('index.html'); + } else { + $c->reply->static('preprod.html'); + } }; get '/tables' => sub { diff --git a/public/index.html b/public/index.html @@ -2,12 +2,12 @@ <html> <head> <meta charset="utf-8"> - <link href="asset/euchre-live.development.css" rel="stylesheet"> + <link href="asset/euchre-live.production.css" rel="stylesheet"> <link href="suits/H.svg" rel="icon" type="image/x-icon" /> <title>Euchre Live!!</title> -</head> -<body> - <div id="content"></div> - <script src="asset/euchre-live.development.js"></script> -</body> + </head> + <body> + <div id="content"></div> + <script src="asset/euchre-live.production.js"></script> + </body> </html>