Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Optimize fonts and asset handling in SCSS and templates #68

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/scss/_poppins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
}

/* latin-ext */
@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');
// @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');

/* latin */
@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');

/* latin-ext */
@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');
// @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');

/* latin */
@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');
4 changes: 2 additions & 2 deletions src/views/404.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>404 - Page not found - Oops!</title>
<link rel="preload" href="../assets/fonts/Poppins-Regular-latin.woff2" as="font" type="font/woff2" crossorigin="anonymous" />
<link rel="preload" href="../assets/images/confused-robot.png?as=webp" as="image" type="image/webp" />
<link rel="preload" href="../assets/fonts/Poppins-Regular-latin.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="../assets/images/confused-robot.png?as=webp" as="image" type="image/webp" crossorigin />
</head>

<body>
Expand Down
11 changes: 5 additions & 6 deletions src/views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
<meta property="og:image:alt" content="Profile picture of Balázs Varga, CTO @ Apter" />
<meta property="og:image:width" content="1366" />
<meta property="og:image:height" content="1269" />
<link rel="preload" href="../assets/fonts/Poppins-Bold-latin.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="../assets/fonts/Poppins-Regular-latin.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="../../node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands-400.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="../../node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff2" as="font" type="font/woff2" crossorigin />
<link rel="canonical" href="<%- baseUrl %>" />
<link rel="preload" href="../assets/images/profile100w100h.png?as=webp" as="image" type="image/webp" />
<link rel="preload" href="../assets/fonts/Poppins-Bold-latin-ext.woff2" as="font" type="font/woff2" crossorigin="anonymous" />
<link rel="preload" href="../assets/fonts/Poppins-Regular-latin-ext.woff2" as="font" type="font/woff2" crossorigin="anonymous" />
<link rel="preload" href="../../node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands-400.woff2" as="font" type="font/woff2" crossorigin="anonymous" />
<link rel="preload" href="../../node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff2" as="font" type="font/woff2" crossorigin="anonymous" />
<script type="application/ld+json">
{
"@context": "https://schema.org",
Expand All @@ -43,7 +42,7 @@
<header>
<picture>
<source type="image/webp" srcset="../assets/images/profile100w100h.png?as=webp" />
<img class="clazz-profile-image" src="../assets/images/profile100w100h.png" alt="Profile picture of Balázs Varga, CTO @ Apter" width="100" height="100" />
<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" />
</picture>
<h1 class="clazz-text-center">Balázs Varga</h1>
</header>
Expand Down
6 changes: 3 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ module.exports = {
module: {
rules: [
{
test: /\.(png|jpg|jpeg|gif|svg|webp)$/,
test: /\.(png|jpg|jpeg|gif|svg|webp)$/i,
type: 'asset/resource',
},
{
test: /\.ejs/,
test: /\.ejs/i,
use: ['html-loader', 'template-ejs-loader'],
},
{
test: /\.s?[ac]ss$/,
test: /\.s?[ac]ss$/i,
use: [
MiniCssExtractPlugin.loader,
{
Expand Down