Module bundling improved to reduce number of requests to 1 JavaScript and 1 CSS file per webpage excl. external resources such as Recaptcha

This commit is contained in:
2024-09-13 23:26:37 +01:00
parent 0c88f161c3
commit d858f47ef5
1490 changed files with 45316 additions and 1372 deletions

View File

@@ -1,12 +1,63 @@
const path = require('path');
const glob = require('glob');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: {
/*
main: [
path.resolve(__dirname, 'static/js/app.js'),
path.resolve(__dirname, 'static/css/main.css')
]
...glob.sync(path.resolve(__dirname, 'static/css/main/** /*.css')) // Include CSS files for the main page
],
*/
// Core
core_home: [
path.resolve(__dirname, 'static/js/pages/core/home.js'),
path.resolve(__dirname, 'static/css/sections/core.css'),
path.resolve(__dirname, 'static/css/pages/core/home.css')
],
core_contact: [
path.resolve(__dirname, 'static/js/pages/core/contact.js'),
path.resolve(__dirname, 'static/css/sections/core.css'),
path.resolve(__dirname, 'static/css/pages/core/contact.css')
],
core_services: [
path.resolve(__dirname, 'static/js/pages/core/services.js'),
path.resolve(__dirname, 'static/css/sections/core.css'),
path.resolve(__dirname, 'static/css/pages/core/services.css')
],
core_admin_home: [
path.resolve(__dirname, 'static/js/pages/core/admin_home.js'),
path.resolve(__dirname, 'static/css/sections/core.css'),
path.resolve(__dirname, 'static/css/pages/core/admin_home.css')
],
// Legal
legal_license: [
path.resolve(__dirname, 'static/js/pages/legal/license.js'),
path.resolve(__dirname, 'static/css/sections/core.css'),
path.resolve(__dirname, 'static/css/pages/legal/license.css')
],
// Store
store_home: [
path.resolve(__dirname, 'static/js/pages/store/home.js'),
path.resolve(__dirname, 'static/css/sections/core.css'),
path.resolve(__dirname, 'static/css/pages/store/home.css')
],
store_product_categories: [
path.resolve(__dirname, 'static/js/pages/store/product_categories.js'),
path.resolve(__dirname, 'static/css/sections/core.css'),
path.resolve(__dirname, 'static/css/pages/store/product_categories.css')
],
store_product_permutations: [
path.resolve(__dirname, 'static/js/pages/store/product_permutations.js'),
path.resolve(__dirname, 'static/css/sections/core.css'),
path.resolve(__dirname, 'static/css/pages/store/product_permutations.css')
],
store_stock_items: [
path.resolve(__dirname, 'static/js/pages/store/stock_items.js'),
path.resolve(__dirname, 'static/css/sections/core.css'),
path.resolve(__dirname, 'static/css/pages/store/stock_items.css')
],
},
output: {
filename: 'js/[name].bundle.js',