Skip to content

Commit

Permalink
perf: move css out of JS to fix layout shift
Browse files Browse the repository at this point in the history
  • Loading branch information
Th3S4mur41 committed May 6, 2021
1 parent d8065f4 commit 6bf9dd4
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 2 deletions.
60 changes: 60 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 @@ -28,6 +28,7 @@
"html-loader": "^2.1.2",
"html-webpack-plugin": "^5.3.1",
"husky": "^6.0.0",
"mini-css-extract-plugin": "^1.6.0",
"node-sass": "^5.0.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.2.13",
Expand Down
9 changes: 7 additions & 2 deletions webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');

module.exports = {
Expand Down Expand Up @@ -33,7 +34,10 @@ module.exports = {
{
test: /\.s[ac]ss$/i,
use: [
'style-loader',
{
loader: MiniCssExtractPlugin.loader,
options: {}
},
{
loader: 'css-loader',
options: {
Expand Down Expand Up @@ -64,6 +68,7 @@ module.exports = {
new HtmlWebpackPlugin({
template: 'src/index.html',
filename: './index.html'
})
}),
new MiniCssExtractPlugin()
]
};

0 comments on commit 6bf9dd4

Please sign in to comment.