webpack: redo page generation

This commit is contained in:
dogeystamp 2023-01-31 15:17:58 -05:00
parent 10d913154c
commit e97b0c4ded
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
3 changed files with 22 additions and 15 deletions

View File

@ -1,11 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>encryptme: Simple AES encryption/decryption</title>
<meta name="description" content="Easy to use and simple online tool for AES encryption and decryption.
Advanced settings allow control over the IV, AES mode, and PBKDF2 parameters.">
<title>encryptme: AES encryption/decryption</title>
</head>
<body>
<h1>AES</h1>

View File

@ -1,10 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>encryptme</title>
<meta name="description" content="Easy to use and simple online tools for encryption and decryption.">
<title>encryptme</title>
</head>
<body>
<h2>Tools</h2>

View File

@ -2,11 +2,20 @@ const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const pages = ["index", "aes"];
const pages = [
{
id: "index",
desc: "Easy to use and simple online tools for encryption and decryption.",
},
{
id: "aes",
desc: "Secure and simple tool for AES, with control over all advanced options like key size, salt, AES mode, and others.",
},
];
module.exports = {
entry: pages.reduce((config, page) => {
config[page] = `./src/${page}.js`;
config[page.id] = `./src/${page.id}.js`;
return config;
}, {}),
output: {
@ -28,10 +37,15 @@ module.exports = {
pages.map(
(page) =>
new HtmlWebpackPlugin({
inject: true,
template: `./src/pages/${page}.html`,
filename: `${page}.html`,
chunks: [page],
inject: "body",
title: `encryptme: ${page.title}`,
meta: {
viewport: "width=device-width, initial-scale=1, shrink-to-fit=no",
description: page.desc
},
filename: `${page.id}.html`,
template: `./src/pages/${page.id}.html`,
chunks: [page.id],
})
)
),