์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- onsnapshot
- sort
- ํ์ ์คํฌ๋ฆฝํธ
- ํฌํธํด๋ฆฌ์ค
- ๋ฐ์ํ์คํจ2
- ๋ ธ๋ง๋์ฝ๋
- reduce
- ๊ฐ๋ฐ์๋ถํด๋ฝ
- ๋ผ์ดํธ๋ชจ๋
- styled-components
- ํด๋ก ์ฝ๋ฉ
- ๋คํฌ๋ชจ๋
- firebase
- Today
- Total
rigood
[HTML] script ํ๊ทธ์ defer, async ๋ณธ๋ฌธ
1. ๊ธฐ๋ณธ ๋์ ์๋ฆฌ
- ๋ธ๋ผ์ฐ์ ๊ฐ html์ ์ฝ๋ค๊ฐ (= html ํ์ฑ) script ํ๊ทธ๋ ์ธ๋ถ script๋ฅผ ๋ง๋๋ฉด, DOM ์์ฑ์ ์ค๋จํ๊ณ script๋ฅผ ๋ค์ด๋ฐ๊ณ ์คํํจ
// script ํ๊ทธ
<script></script>
// ์ธ๋ถ script
<script src="์ฃผ์" />
- script ์๋์ ์๋ DOM ์์์๋ ์ ๊ทผํ ์ ์์
- script ์ฉ๋์ด ํฐ ๊ฒฝ์ฐ, script๋ฅผ ๋ค์ด๋ฐ๋ ๋์ ์ฌ์ฉ์๋ script ์๋์ชฝ ํ์ด์ง๋ฅผ ๋ณผ ์ ์์
2. script๋ฅผ ํ์ด์ง ๋งจ ์๋ ๋ฐฐ์น
- 1๋ฒ์์ ์ธ๊ธ๋ ๋ถ์์ฉ์ ํด๊ฒฐ๋๋,
- html ๋ฌธ์ ์ฉ๋์ด ํฐ ๊ฒฝ์ฐ, html์ ๋ค์ด๋ฐ์ ํ script๋ฅผ ๋ค์ด๋ฐ์ผ๋ฉด ํ์ด์ง๊ฐ ๊ต์ฅํ ๋๋ ค์ง
3. defer ์์ฑ ์ฌ์ฉ (์ง์ฐ ์คํฌ๋ฆฝํธ)
<script defer src="์ฃผ์" />
- script๋ฅผ ๋ฐฑ๊ทธ๋ผ์ด๋์์ ๋ค์ด๋ฐ์ผ๋ฏ๋ก html ํ์ฑ์ด ๋ฉ์ถ์ง ์์
- html ํ์ฑ์ด ๋๋ ํ, DOMContentLodaded ์ด๋ฒคํธ๊ฐ ๋ฐ์ํ๊ธฐ ์ ์ script๊ฐ ์คํ๋จ
- html ๋ฌธ์์ ์ถ๊ฐ๋ ์์๋๋ก script๊ฐ ์คํ๋จ
4. async ์์ฑ ์ฌ์ฉ (๋น๋๊ธฐ ์คํฌ๋ฆฝํธ)
<script async src="์ฃผ์" />
- defer ์์ฑ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก script๋ฅผ ๋ฐฑ๊ทธ๋ผ์ด๋์์ ๋ค์ด๋ฐ์ผ๋ฏ๋ก html ํ์ฑ์ด ๋ฉ์ถ์ง ์์
- html ํ์ฑ ์๋ฃ ์ฌ๋ถ์ ์๊ด์์ด ๋ค์ด๋ก๋ ๋๋ฉด script๊ฐ ์คํ๋จ
- script๊ฐ ์คํ๋ ๋๋ html ํ์ฑ์ด ๋ฉ์ถค
- ๋จผ์ ๋ค์ด๋ก๋ ๋ script๊ฐ ๋จผ์ ์คํ๋จ
์ถ์ฒ
'๐จ ํ๋ก ํธ์๋ > html & css' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[CSS] word-wrap, overflow-wrap, word-break ์ฐจ์ด์ (0) | 2023.06.06 |
---|---|
[HTML] ์๋์์ฑ ๊ธฐ๋ณธ ํ ํ๋ฆฟ (0) | 2023.06.03 |
[CSS] flex-wrap (0) | 2023.01.02 |