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> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <title>encryptme: AES encryption/decryption</title>
<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.">
</head> </head>
<body> <body>
<h1>AES</h1> <h1>AES</h1>

View File

@ -1,10 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <title>encryptme</title>
<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.">
</head> </head>
<body> <body>
<h2>Tools</h2> <h2>Tools</h2>

View File

@ -2,11 +2,20 @@ const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin"); const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-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 = { module.exports = {
entry: pages.reduce((config, page) => { entry: pages.reduce((config, page) => {
config[page] = `./src/${page}.js`; config[page.id] = `./src/${page.id}.js`;
return config; return config;
}, {}), }, {}),
output: { output: {
@ -28,10 +37,15 @@ module.exports = {
pages.map( pages.map(
(page) => (page) =>
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
inject: true, inject: "body",
template: `./src/pages/${page}.html`, title: `encryptme: ${page.title}`,
filename: `${page}.html`, meta: {
chunks: [page], 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],
}) })
) )
), ),