Google Lighthouse
perfomance: ์น ์ฑ๋ฅ์ ์ธก์ .
perfomance ์ธก์ ์ ๊ธฐ์ค์ด ๋๋ ํญ๋ชฉ:
Eliminate render-blocking resources
Properly size images
Defer offscreen images
Minify CSS
Minify JavaScript
Remove unused CSS
Efficiently encode images
Serve images in modern formats
Enable text compression
Preconnect to required origins
Reduce server response times (TTFB)
Avoid multiple page redirects
Preload key requests
Use video formats for animated content
Reduce the impact of third-party code
Avoid non-composited animations
Lazy load third-party resources with facades
Minify CSS
CSS ํ์ผ์ ์ถ์ํ์ฌ ํ์ด์ง ๋ก๋ ์ฑ๋ฅ์ ํฅ์์ํฌ ์ ์๋ค.
ex)
//before
h1 {
background-color: #000000;
}
h2 {
background-color: #000000;
}
//after
h1,
h2 {
background-color: #000000;
}
๋ํ ์ ์์ ์ ๊ฐ์ ์์์ฝ๋๋ #000000
๋์ #000
์ผ๋ก ํ๋ฒ ๋ ์ถ์ฝํด ์ฌ์ฉํ ์ ์๋ค.
use video formats for animated content
ํฐ GIF ์ด๋ฏธ์ง๋ ์ฝํ
์ธ ๋ฅผ ์ ๋ฌํ๋ ๋ฐ ๋นํจ์จ์ ์ด๊ธฐ ๋๋ฌธ์ ๋น๋์ค๋ก ๋ณํํ๋ฉด ์ฌ์ฉ์์ ๋์ญํญ์ ํฌ๊ฒ ์ ์ฝํ ์ ์๋ค. ๋คํธ์ํฌ ๋ฐ์ดํธ๋ฅผ ์ ์ฝํ๊ธฐ ์ํด ์ ๋๋ฉ์ด์
์๋ MPEF4/WebM ๋น๋์ค๋ฅผ ์ฌ์ฉํ๊ณ ์ ์ ์ด๋ฏธ์ง์๋ PNG/WebP๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ์ข๋ค.
FFmpeg๋ฅผ ์ฌ์ฉํด MPEF ๋น๋์ค ๋ง๋ค๊ธฐ
FFmpeg๋ฅผ ์ฌ์ฉํ์ฌ GIF my-animation.gif
๋ฅผ MP4 ๋น๋์ค๋ก ๋ณํํ๋ ค๋ฉด ๋ค์ ๋ช
๋ น์ ์คํํ๋ฉด ๋๋ค.
ffmpeg -i my-animation.gif my-animation.mp4
์ด๋ ๊ฒ ํ๋ฉด FFmpeg๊ฐ ํ๋๊ทธ my-animation.gif
๋ก ํ์๋๋ ์
๋ ฅ -i์ ๋ฐ์ ๋น๋์ค๋ผ๋ ๋น๋์ค๋ก ๋ณํํ๋๋ก ์ง์ํ๋ค. my-animation.mp4
FFmpeg๋ฅผ ์ฌ์ฉํด WebM ๋น๋์ค ๋ง๋ค๊ธฐ
WebM ๋น๋์ค๋ MP4 ๋น๋์ค๋ณด๋ค ํจ์ฌ ์์ง๋ง ๋ชจ๋ ๋ธ๋ผ์ฐ์ ๊ฐ WebM์ ์ง์ํ๋ ๊ฒ์ ์๋๋ฏ๋ก ๋ ๋ค ์์ฑํ๋ ๊ฒ์ด ์ข๋ค.
FFmpeg๋ฅผ ์ฌ์ฉํ์ฌ my-animation.gif
๋ฅผ WebM ๋น๋์ค๋ก ๋ณํํ๋ ค๋ฉด ๋ค์ ๋ช
๋ น์ ์คํํ๋ฉด ๋๋ค.
ffmpeg -i my-animation.gif -c vp9 -b:v 0 -crf 41 my-animation.webm
Minify JavaScript
์ฌ์ฉํ์ง ์๋ ์๋ฐ์คํฌ๋ฆฝํธ ์ฝ๋๋ฅผ ์ญ์ ํ๊ฑฐ๋ ํ์์ ์ด ์๋ whitespace๋ฅผ ์์ ๋ ๊ฒ์ ์๋ฐ์คํฌ๋ฆฝํธ ์ฝ๋๋ฅผ ์ต์ ํ ์ํค๋๋ฐ ๋์์ ์ค ์ ์๋ค. ๊ทธ๋ฆฌ๊ณ ์ต์ ํ๋ JavaScript์ฝ๋๋ ์ฝ๋๋ฅผ parseํ๋ ์๊ฐ๊ณผ payload์ ํฌ๊ธฐ๋ฅผ ์ค์ผ ์ ์๋ค.
๋ฆฌ์กํธ์ ๊ฒฝ์ฐ, npm run build๋ก ์ฝ๋๊ฐ ์๋์ผ๋ก ์ต์ ํ ๋๋ค๋ฉด, production ๋ชจ๋๋ก ๋น๋๋ฅผ ํ๊ณ ์๋์ง ๊ผญ ํ์ธํด์ผ ํ๋ค.
Leave a comment