Skip to content

Commit

Permalink
refactor: Remove Font Awesome dependency and use inline SVGs (#69)
Browse files Browse the repository at this point in the history
- Replaced Font Awesome with custom inline SVGs for social and external link icons.
- Removed `@fortawesome/fontawesome-free` package and related SCSS imports.
- Updated CSP rules to support additional Google Analytics domains.
- Adjusted social link icon styles using filters for consistency.
- Simplified Webpack configuration for SVG handling.
  • Loading branch information
warnyul authored Dec 4, 2024
1 parent 5f59683 commit e264750
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 37 deletions.
14 changes: 0 additions & 14 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"webpack-dev-server": "^5.0.0"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.7.1",
"firebase": "^11.0.0"
}
}
1 change: 1 addition & 0 deletions src/assets/images/fa6-brands-bluesky.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/images/fa6-brands-github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/images/fa6-brands-linkedin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/images/fa6-solid-arrow-up-right-from-square.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 0 additions & 8 deletions src/scss/_fontawesome.scss

This file was deleted.

11 changes: 3 additions & 8 deletions src/scss/index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@use "poppins";
@use "fontawesome";
@use "variables" as *;

// Reset
Expand Down Expand Up @@ -97,22 +96,18 @@ h1 {
.clazz-social-link-container {
a {
display: inline-block;
color: $primary-color;
filter: brightness(0) saturate(100%) invert(34%) sepia(3%) saturate(2463%) hue-rotate(176deg) brightness(90%) contrast(90%);
padding: calc($gap /2 ) $gap;
transition: color 0.3s ease;
&:visited {
color: $primary-color;
filter: brightness(0) saturate(100%) invert(34%) sepia(3%) saturate(2463%) hue-rotate(176deg) brightness(90%) contrast(90%);
}
&:hover {
color: $hover-color;
filter: brightness(0) saturate(100%) invert(60%) sepia(53%) saturate(460%) hue-rotate(94deg) brightness(88%) contrast(94%);
}
}
}

.fa-2xl {
line-height: 1;
}

// Footer
footer {
display: flex;
Expand Down
6 changes: 2 additions & 4 deletions src/views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
<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 %>" />
<script type="application/ld+json">
{
Expand Down Expand Up @@ -56,13 +54,13 @@
<% socialLinks.forEach(function(link) { %>
<div class="clazz-social-link-container">
<a href="<%- link.url %>" aria-label="Visit <%= link.name %>" target="_blank" rel="noopener noreferrer ugc">
<i class="fa-brands fa-<%- link.icon %> fa-2xl"></i>
<%- include(`../assets/images/fa6-brands-${link.icon}.svg`) %>
</a>
</div>
<% }); %>
<div class="clazz-social-link-container">
<a class="clazz-copy-link" href="#" aria-label="Copy link" rel="noopener">
<i class="fa-solid fa-arrow-up-right-from-square fa-2xl"></i>
<%- include(`../assets/images/fa6-solid-arrow-up-right-from-square.svg`) %>
</a>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = {
module: {
rules: [
{
test: /\.(png|jpg|jpeg|gif|svg|webp)$/i,
test: /\.(png|jpg|jpeg|gif|webp)$/i,
type: 'asset/resource',
},
{
Expand Down Expand Up @@ -189,7 +189,7 @@ module.exports = {
'style-src': ["'self'"],
'img-src': ["'self'"],
'font-src': ["'self'"],
'connect-src': ["'self'", "https://google-analytics.com", "https://firebase.googleapis.com", "https://firebaseinstallations.googleapis.com"],
'connect-src': ["'self'", "https://*.google-analytics.com", "https://firebase.googleapis.com", "https://firebaseinstallations.googleapis.com"],
},
{
hashingMethod: 'sha256',
Expand Down

0 comments on commit e264750

Please sign in to comment.