compress bundled js

This commit is contained in:
AlecM33
2023-03-11 17:07:31 -05:00
parent ed7beb50a5
commit e0986cefde
16 changed files with 223 additions and 25 deletions

View File

@@ -20,7 +20,7 @@ export const HTMLFragments = {
</div>
</div>
<div>
<button id='role-info-button' class='app-button'>Roles in This Game <img src='/images/info.svg'/></button>
<button id='role-info-button' class='app-button'>Roles in This Game <img alt='Info icon' src='/images/info.svg'/></button>
</div>
</div>
<div>
@@ -75,7 +75,7 @@ export const HTMLFragments = {
</div>
</div>
<div>
<button id='role-info-button' class='app-button'>Roles in This Game <img src='/images/info.svg'/></button>
<button id='role-info-button' class='app-button'>Roles in This Game <img alt='Info icon' src='/images/info.svg'/></button>
</div>
</div>
<div id='game-role' tabindex="0">
@@ -114,7 +114,7 @@ export const HTMLFragments = {
</div>
</div>
<div>
<button id='role-info-button' class='app-button'>Roles in This Game <img src='/images/info.svg'/></button>
<button id='role-info-button' class='app-button'>Roles in This Game <img alt='Info icon' src='/images/info.svg'/></button>
</div>
</div>
<div id='game-people-container'>
@@ -157,9 +157,11 @@ export const HTMLFragments = {
<div id="play-pause-placeholder"></div>
</div>
</div>
<button id='mod-transfer-button' class='moderator-player-button make-mod-button app-button'>Transfer Mod Powers <img src='/images/shuffle.svg'/></button>
<button id='mod-transfer-button' class='moderator-player-button make-mod-button app-button'>
Transfer Mod Powers <img alt='transfer icon' src='/images/shuffle.svg'/>
</button>
<div>
<button id='role-info-button' class='app-button'>Roles in This Game <img src='/images/info.svg'/></button>
<button id='role-info-button' class='app-button'>Roles in This Game <img alt='Info icon' src='/images/info.svg'/></button>
</div>
</div>
<div id="game-players-container">
@@ -201,7 +203,7 @@ export const HTMLFragments = {
<div id='play-pause'> </div>
</div>
<div>
<button id='role-info-button' class='app-button'>Roles in This Game <img src='/images/info.svg'/></button>
<button id='role-info-button' class='app-button'>Roles in This Game <img alt='Info icon' src='/images/info.svg'/></button>
</div>
</div>
<div id='game-role' tabindex="0">
@@ -285,7 +287,7 @@ export const HTMLFragments = {
`<div id='end-of-game-header'>
<h2>&#x1F3C1; The moderator has ended the game. Roles are revealed.</h2>
<div id="end-of-game-buttons">
<button id='role-info-button' class='app-button'>Roles in This Game <img src='/images/info.svg'/></button>
<button id='role-info-button' class='app-button'>Roles in This Game <img alt='Info icon' src='/images/info.svg'/></button>
<a href='/'>
<button class='app-button'>Go Home \uD83C\uDFE0</button>
</a>

View File

@@ -71,12 +71,12 @@ export class InProgress {
};
if (spectatorCount) {
spectatorCount?.addEventListener('click', spectatorHandler);
spectatorCount?.addEventListener('keyup', spectatorHandler);
SharedStateUtil.setNumberOfSpectators(
this.stateBucket.currentGameState.people.filter(p => p.userType === globals.USER_TYPES.SPECTATOR).length,
spectatorCount
);
spectatorCount?.addEventListener('click', spectatorHandler);
spectatorCount?.addEventListener('keyup', spectatorHandler);
}
}

View File

@@ -59,9 +59,15 @@ export class Lobby {
const playerCount = this.container.querySelector('#game-player-count');
playerCount.innerText = this.stateBucket.currentGameState.gameSize + ' Players';
this.container.querySelector('#spectator-count').addEventListener('click', () => {
Confirmation(SharedStateUtil.buildSpectatorList(this.stateBucket.currentGameState.people), null, true);
});
const spectatorHandler = (e) => {
if (e.type === 'click' || e.code === 'Enter') {
Confirmation(SharedStateUtil.buildSpectatorList(this.stateBucket.currentGameState.people
.filter(p => p.userType === globals.USER_TYPES.SPECTATOR)), null, true);
}
};
this.container.querySelector('#spectator-count').addEventListener('click', spectatorHandler);
this.container.querySelector('#spectator-count').addEventListener('keyup', spectatorHandler);
SharedStateUtil.setNumberOfSpectators(
this.stateBucket.currentGameState.people.filter(p => p.userType === globals.USER_TYPES.SPECTATOR).length,

View File

@@ -152,6 +152,7 @@ export class GameTimerManager {
const playBtn = document.createElement('img');
playBtn.setAttribute('src', '../images/play-button.svg');
playBtn.setAttribute('alt', 'play button');
playBtn.setAttribute('tabindex', '0');
playBtn.addEventListener('click', this.playListener);
playBtn.addEventListener('keyup', this.playListener);

View File

@@ -287,7 +287,7 @@ button {
#game-parameters {
font-family: signika-negative, sans-serif;
color: #d7d7d7;
font-size: 25px;
font-size: 20px;
margin: 0.5em;
}
@@ -591,7 +591,7 @@ input {
}
.evil, .compact-card.evil .card-role {
color: #dd2929 !important;
color: #e51a1a !important;
font-weight: bold;
}

View File

@@ -27,6 +27,6 @@
<h3>The game or other resource that you are looking for could not be found, or you don't have permission to access it.
Old games are periodically cleared.</h3>
</div>
<script src="/dist/notFound-bundle.js"></script>
<script src="/dist/notFound-bundle.js.gz"></script>
</body>
</html>

View File

@@ -23,6 +23,6 @@
<div id="mobile-menu-background-overlay"></div>
<div id="navbar"></div>
<div id="game-creation-container" class="container"></div>
<script src="/dist/create-bundle.js"></script>
<script src="/dist/create-bundle.js.gz"></script>
</body>
</html>

View File

@@ -20,8 +20,8 @@
<link rel="preload" href="/webfonts/SignikaNegative-Light.woff2" as="font" type="font/woff2" crossorigin>
</head>
<body>
<script src="/dist/game-bundle.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script src="/dist/game-bundle.js.gz"></script>
<script src="/socket.io/socket.io.min.js"></script>
</body>
</html>

View File

@@ -59,6 +59,6 @@
<a aria-label="email the creator with questions" href="mailto:play.werewolf.contact@gmail.com?Subject=Werewolf App" target="_top"><img alt="email" src='/images/email.svg'/></a>
</div>
</footer>
<script src="/dist/home-bundle.js"></script>
<script src="/dist/home-bundle.js.gz"></script>
</body>
</html>

View File

@@ -143,6 +143,6 @@
<br><br>
</div>
</div>
<script src="/dist/howToUse-bundle.js"></script>
<script src="/dist/howToUse-bundle.js.gz"></script>
</body>
</html>

View File

@@ -51,7 +51,7 @@
</div>
</form>
</div>
<script src="/dist/join-bundle.js"></script>
<script src="/dist/join-bundle.js.gz"></script>
</body>
</html>

View File

@@ -1,4 +1,5 @@
const path = require('path');
const CompressionPlugin = require("compression-webpack-plugin");
module.exports = {
entry: {
@@ -11,8 +12,11 @@ module.exports = {
},
output: {
path: path.resolve(__dirname, '../dist'),
filename: "[name]-bundle.js"
filename: "[name]-bundle.js",
},
plugins: [new CompressionPlugin({
exclude: [/.map$/, /521-bundle.js$/]
})],
mode: "development",
node: false,
devtool: 'source-map',

View File

@@ -1,4 +1,5 @@
const path = require('path');
const CompressionPlugin = require("compression-webpack-plugin");
'use strict';
module.exports = {
@@ -14,6 +15,7 @@ module.exports = {
path: path.resolve(__dirname, '../dist'),
filename: "[name]-bundle.js"
},
plugins: [new CompressionPlugin({ deleteOriginalAssets: true, exclude: [/521-bundle.js$/]})],
mode: "production",
node: false,
module: {