Skip to content

Commit

Permalink
chore: Inlining javascript (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
warnyul authored Nov 27, 2024
1 parent 8c4d5d4 commit 3a405ec
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
23 changes: 23 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"cssnano-preset-advanced": "^7.0.0",
"firebase-tools": "^13.0.0",
"html-inline-css-webpack-plugin": "^1.11.1",
"html-inline-script-webpack-plugin": "^3.2.1",
"html-loader": "^5.1.0",
"html-minifier": "^4.0.0",
"html-minimizer-webpack-plugin": "^3.5.0",
Expand Down
17 changes: 7 additions & 10 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {htmlWebpackPluginTemplateCustomizer} = require('template-ejs-loader');
const HTMLInlineCSSWebpackPlugin = require("html-inline-css-webpack-plugin").default;
const { PurgeCSSPlugin } = require('purgecss-webpack-plugin');
const MangleCssClassPlugin = require('mangle-css-class-webpack-plugin');
const HtmlInlineScriptWebpackPlugin = require('html-inline-script-webpack-plugin');

const glob = require('glob');
const path = require('path');
Expand All @@ -35,14 +36,7 @@ module.exports = {
},
{
test: /\.ejs/,
use: [
{
loader: 'html-loader'
},
{
loader: 'template-ejs-loader',
},
],
use: ['html-loader', 'template-ejs-loader'],
},
{
test: /\.s?[ac]ss$/,
Expand Down Expand Up @@ -137,8 +131,8 @@ module.exports = {
}
}),
filename: 'index.html',
inject: true,
hash: true,
inject: 'body',
hash: false,
minify: {
collapseWhitespace: true,
removeComments: true,
Expand All @@ -153,6 +147,9 @@ module.exports = {
log: true,
}),
new HTMLInlineCSSWebpackPlugin(),
new HtmlInlineScriptWebpackPlugin({
scriptMatchPattern: [/.*\.js?$/], // Match hashed JS files
}),
],
optimization: {
minimize: true,
Expand Down

0 comments on commit 3a405ec

Please sign in to comment.