Skip to content

Commit 5f59683

Browse files
authored
fix: Optimize fonts and asset handling in SCSS and templates (#68)
- Commented out unused Poppins font definitions in `_poppins.scss` for efficiency. - Updated preload links in `404.ejs` and `index.ejs` to include consistent `crossorigin` attributes. - Applied eager loading to the profile image in `index.ejs` for faster above-the-fold rendering. - Enhanced Webpack module rules to use case-insensitive regex for image, EJS, and SCSS files.
1 parent 36f58cb commit 5f59683

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

src/scss/_poppins.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
}
1717

1818
/* latin-ext */
19-
@include font-face('Poppins', normal, 400, '../assets/fonts/Poppins-Regular-latin-ext.woff2', 'U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF');
19+
// @include font-face('Poppins', normal, 400, '../assets/fonts/Poppins-Regular-latin-ext.woff2', 'U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF');
2020

2121
/* latin */
2222
@include font-face('Poppins', normal, 400, '../assets/fonts/Poppins-Regular-latin.woff2', 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD');
2323

2424
/* latin-ext */
25-
@include font-face('Poppins', normal, 700, '../assets/fonts/Poppins-Bold-latin-ext.woff2', 'U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF');
25+
// @include font-face('Poppins', normal, 700, '../assets/fonts/Poppins-Bold-latin-ext.woff2', 'U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF');
2626

2727
/* latin */
2828
@include font-face('Poppins', normal, 700, '../assets/fonts/Poppins-Bold-latin.woff2', 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD');

src/views/404.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
77
<title>404 - Page not found - Oops!</title>
8-
<link rel="preload" href="../assets/fonts/Poppins-Regular-latin.woff2" as="font" type="font/woff2" crossorigin="anonymous" />
9-
<link rel="preload" href="../assets/images/confused-robot.png?as=webp" as="image" type="image/webp" />
8+
<link rel="preload" href="../assets/fonts/Poppins-Regular-latin.woff2" as="font" type="font/woff2" crossorigin />
9+
<link rel="preload" href="../assets/images/confused-robot.png?as=webp" as="image" type="image/webp" crossorigin />
1010
</head>
1111

1212
<body>

src/views/index.ejs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
<meta property="og:image:alt" content="Profile picture of Balázs Varga, CTO @ Apter" />
1616
<meta property="og:image:width" content="1366" />
1717
<meta property="og:image:height" content="1269" />
18+
<link rel="preload" href="../assets/fonts/Poppins-Bold-latin.woff2" as="font" type="font/woff2" crossorigin />
19+
<link rel="preload" href="../assets/fonts/Poppins-Regular-latin.woff2" as="font" type="font/woff2" crossorigin />
20+
<link rel="preload" href="../../node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands-400.woff2" as="font" type="font/woff2" crossorigin />
21+
<link rel="preload" href="../../node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff2" as="font" type="font/woff2" crossorigin />
1822
<link rel="canonical" href="<%- baseUrl %>" />
19-
<link rel="preload" href="../assets/images/profile100w100h.png?as=webp" as="image" type="image/webp" />
20-
<link rel="preload" href="../assets/fonts/Poppins-Bold-latin-ext.woff2" as="font" type="font/woff2" crossorigin="anonymous" />
21-
<link rel="preload" href="../assets/fonts/Poppins-Regular-latin-ext.woff2" as="font" type="font/woff2" crossorigin="anonymous" />
22-
<link rel="preload" href="../../node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands-400.woff2" as="font" type="font/woff2" crossorigin="anonymous" />
23-
<link rel="preload" href="../../node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff2" as="font" type="font/woff2" crossorigin="anonymous" />
2423
<script type="application/ld+json">
2524
{
2625
"@context": "https://schema.org",
@@ -43,7 +42,7 @@
4342
<header>
4443
<picture>
4544
<source type="image/webp" srcset="../assets/images/profile100w100h.png?as=webp" />
46-
<img class="clazz-profile-image" src="../assets/images/profile100w100h.png" alt="Profile picture of Balázs Varga, CTO @ Apter" width="100" height="100" />
45+
<img class="clazz-profile-image" src="../assets/images/profile100w100h.png" alt="Profile picture of Balázs Varga, CTO @ Apter" loading="eager" width="100" height="100" />
4746
</picture>
4847
<h1 class="clazz-text-center">Balázs Varga</h1>
4948
</header>

webpack.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ module.exports = {
4545
module: {
4646
rules: [
4747
{
48-
test: /\.(png|jpg|jpeg|gif|svg|webp)$/,
48+
test: /\.(png|jpg|jpeg|gif|svg|webp)$/i,
4949
type: 'asset/resource',
5050
},
5151
{
52-
test: /\.ejs/,
52+
test: /\.ejs/i,
5353
use: ['html-loader', 'template-ejs-loader'],
5454
},
5555
{
56-
test: /\.s?[ac]ss$/,
56+
test: /\.s?[ac]ss$/i,
5757
use: [
5858
MiniCssExtractPlugin.loader,
5959
{

0 commit comments

Comments
 (0)