Skip to content

Commit 35fb692

Browse files
committed
REF : Improved performance of web assets loading using webp format
1 parent c3cfcf1 commit 35fb692

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

src/components/about/About.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { FaAward } from "react-icons/fa";
22
import { FiUsers } from "react-icons/fi";
33
import { VscFolderLibrary } from "react-icons/vsc";
44
import portrait from "../../../public/assets/long-portrait-self.png";
5+
import portraitwebp from "../../../public/assets/long-portrait-self.webp";
56
import "./about.css";
67

78
const About = () => {
@@ -12,7 +13,10 @@ const About = () => {
1213
<div className="container about__container">
1314
<div className="about__me">
1415
<div className="about__portrait_image">
15-
<img src={portrait} alt="Portrait"></img>
16+
<picture>
17+
<source srcSet={portraitwebp} type="image/webp" id="card__image"/>
18+
<img src={portrait} loading="lazy" alt="Portrait" id="card__image"/>
19+
</picture>
1620
</div>
1721
</div>
1822

src/components/header/Header.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Buttons from "./Buttons";
22
import profilepicture from "../../../public/assets/profile-picture.jpg";
3+
import profilepicturewebp from "../../../public/assets/profile-picture.webp";
34
import HeaderSocials from "./HeaderSocials";
45
import "./header.css";
56

@@ -13,7 +14,10 @@ const Header = () => {
1314
<Buttons />
1415
<HeaderSocials />
1516
<div className="header__profile">
16-
<img src={profilepicture} alt="me" className="image"></img>
17+
<picture>
18+
<source srcSet={profilepicturewebp} type="image/webp" className="image"/>
19+
<img src={profilepicture} alt="me" className="image"></img>
20+
</picture>
1721
</div>
1822
<a href="#contact" className="scroll__down">
1923
Scroll Down

src/components/header/header.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ header {
4444
border-radius: 12rem;
4545
}
4646

47-
.header__profile > .image {
47+
.header__profile .image {
4848
border-radius: 100%;
4949
}
5050

src/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ body {
3838
background: var(--color-bg);
3939
color: var(--color-white);
4040
line-height: 1.7;
41-
background-image: url("/assets/bg-texture.png");
41+
background-image: url("/assets/bg-texture.webp");
4242
}
4343

4444
.container {

0 commit comments

Comments
 (0)