Skip to content

Commit 842b1fb

Browse files
committed
fix: Improve asset handling, fonts, and image loading
- Updated font preload links in `404.ejs` and `index.ejs` with consistent `crossorigin` attributes. - Adjusted font paths in `_poppins.scss` and commented out unnecessary font-face declarations for optimization. - Added `loading="eager"` to profile image in `index.ejs` for improved user experience. - Enhanced Webpack asset handling with case-insensitive regex for image, EJS, and SCSS file matching.
1 parent 36f58cb commit 842b1fb

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
<meta property="og:image:width" content="1366" />
1717
<meta property="og:image:height" content="1269" />
1818
<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" />
19+
<link rel="preload" href="../assets/images/profile100w100h.png?as=webp" as="image" type="image/webp" crossorigin />
20+
<link rel="preload" href="../assets/fonts/Poppins-Bold-latin.woff2" as="font" type="font/woff2" crossorigin />
21+
<link rel="preload" href="../assets/fonts/Poppins-Regular-latin.woff2" as="font" type="font/woff2" crossorigin />
22+
<link rel="preload" href="../../node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands-400.woff2" as="font" type="font/woff2" crossorigin />
23+
<link rel="preload" href="../../node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff2" as="font" type="font/woff2" crossorigin />
2424
<script type="application/ld+json">
2525
{
2626
"@context": "https://schema.org",
@@ -43,7 +43,7 @@
4343
<header>
4444
<picture>
4545
<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" />
46+
<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" />
4747
</picture>
4848
<h1 class="clazz-text-center">Balázs Varga</h1>
4949
</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)