๊ฐœ๋ฐœ ๐Ÿพ/ETC

VS Code ์‚ฌ์šฉํ•˜๋ฉด์„œ ์œ ์šฉํ•œ ๊ธฐ๋Šฅ๋“ค ์ •๋ฆฌ!

JOTOKKI 2021. 2. 4. 19:30
728x90

* VSCode ์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ๋‹จ์ถ•ํ‚ค

1. Tabํ‚ค ์•ˆ๋จน์„ ๋•Œ

๊ฐ•์•„์ง€๊ฐ€ ํ‚ค๋ณด๋“œ์—์„œ ๋ฐœ์žฅ๊ตฌ๋ฅผ ์ณค๋”๋‹ˆ VSCode ์—๋””ํ„ฐ ํ™”๋ฉด์—์„œ ๊ฐ‘์ž๊ธฐ ํƒญํ‚ค๊ฐ€ ๋จน์งˆ ์•Š์•˜๋‹ค. 

ํƒญํ‚ค ๋Œ€์‹  ์™ผ์ชฝ ๋ฉ”๋‰ด ๋ถ€๋ถ„์ด ํ™œ์„ฑํ™” ๋œ๋‹ค๋ฉด Ctrl + M ์„ ๋ˆ„๋ฅด๋ฉด ํ•ด์ œ๋œ๋‹ค. 

 

2. ๊ฐ™์€ ๋‹จ์–ด ์„ ํƒํ•˜๊ธฐ

Ctrl + D : Ctrl ๋ˆ„๋ฅธ ์ƒํƒœ์—์„œ d ๋ฅผ ๋ˆ„๋ฅด๋ฉด ๊ฐ™์€ ๋‹จ์–ด๋ฅผ ์‰ฝ๊ฒŒ ์ฐพ์„ ์ˆ˜ ์žˆ๋‹ค. ์™„์ „ ์Šต๊ด€์ฒ˜๋Ÿผ ์”€. 


* React Snippets ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ

1. React Snippets ์„ค์ •ํ•˜๊ธฐ

React Snippets ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๋‹ค์šด ๋ฐ›๋Š”๋‹ค. 

- ๋‚ด๊ฐ€ ์‚ฌ์šฉํ•˜๋Š” ์„ธํŒ…

{
    "workbench.iconTheme": "material-icon-theme",
    "workbench.startupEditor": "newUntitledFile",
    "peacock.favoriteColors": [
        {
            "name": "Angular Red",
            "value": "#b52e31"
        },
        {
            "name": "Auth0 Orange",
            "value": "#eb5424"
        },
        {
            "name": "Azure Blue",
            "value": "#007fff"
        },
        {
            "name": "C# Purple",
            "value": "#68217A"
        },
        {
            "name": "Gatsby Purple",
            "value": "#639"
        },
        {
            "name": "Go Cyan",
            "value": "#5dc9e2"
        },
        {
            "name": "Java Blue-Gray",
            "value": "#557c9b"
        },
        {
            "name": "JavaScript Yellow",
            "value": "#f9e64f"
        },
        {
            "name": "Mandalorian Blue",
            "value": "#1857a4"
        },
        {
            "name": "Node Green",
            "value": "#215732"
        },
        {
            "name": "React Blue",
            "value": "#00b3e6"
        },
        {
            "name": "Something Different",
            "value": "#832561"
        },
        {
            "name": "Vue Green",
            "value": "#42b883"
        }
    ],
    "javascript.updateImportsOnFileMove.enabled": "never",
    "liveServer.settings.donotShowInfoMsg": true,
    "emmet.includeLanguages": {
        "javascript": "javascriptreact" 
    },
    "workbench.colorTheme": "Tomorrow Night Blue"
}

 

 

2. Live Server

1. live server ๊ฒ€์ƒ‰ํ›„ install

2. ์›ํ•˜๋Š” ํŒŒ์ผ์„ ์—ฐํ›„ ํ•˜๋‹จ์˜ Go live ๋ผ๊ณ  ์”Œ์ธ ๋ถ€๋ถ„ ํด๋ฆญํ•˜๋ฉด ์ž๋™์œผ๋กœ ์—ด๋ฆฐ๋‹ค.

 


* ๊ทธ ์™ธ React ๊ฐœ๋ฐœ์‹œ ์œ ์šฉํ•œ ์„ค์ •

1. ๋ฆฌ์•กํŠธ์—์„œ JSX ์ž๋™์™„์„ฑ ์ ์šฉํ•˜๊ธฐ

setting.jsonํŒŒ์ผ์—์„œ emmet language์„ค์ •์„ ํ•ด์ฃผ๋ฉด๋œ๋‹ค.

"emmet.includeLanguages": {
    "javascript" : "javascriptreact"
}

 

2. Snippet ์ง์ ‘ ๋งŒ๋“ค๊ธฐ! 

๋ฆฌ์•กํŠธ ์Šคํƒ€์ผ๋ง์‹œ ์ด๋ชจ์…˜์„ ์ฃผ๋กœ ์‚ฌ์šฉํ•˜๋Š”๋ฐ emotion์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด 

์ตœ ์ƒ๋‹จ์— ํ•ญ์ƒ ์ถ”๊ฐ€ ์ฝ”๋“œ๋ฅผ ์ฃผ์–ด์•ผ ํ•˜๋ฏ€๋กœ ๋งค๋ฒˆ ๋„ฃ์–ด์ฃผ๋Š”๊ฒŒ ๊ท€์ฐฎ๋‹ค. 

snippet์œผ๋กœ ์ถ”๊ฐ€ ์„ค์ •์„ ํ•˜๋ฉด ์‰ฝ๊ณ  ๋” ๋น ๋ฅด๊ฒŒ ๊ฐœ๋ฐœํ•  ์ˆ˜ ์žˆ๋‹ค. 

 

2-1.

https://snippet-generator.app/

์‚ฌ์ดํŠธ์— ์ ‘์†ํ•œ๋’ค ์›ํ•˜๋Š” ํ…œํ”Œ๋ฆฟ ๊ตฌ์กฐ๋ฅผ ์™ผ์ชฝ์— ์ž‘์„ฑํ•œ๋‹ค.

 

2-2. vscode ๋กœ ๋Œ์•„์™€์„œ

File > Preferences > User Snippet ์„ ํด๋ฆญํ•˜๋ฉด ์ƒ๋‹จ์— ์‚ฌ์šฉํ•  ์–ธ์–ด๋ฅผ ์“ฐ๋ฉด๋œ๋‹ค

javascriptreact.json ์„ ์„ ํƒ ํ›„ ์‚ฌ์ดํŠธ์—์„œ ๋ณ€ํ™˜๋œ ์ฝ”๋“œ๋ฅผ ์‚ฝ์ž…ํ•ด์ฃผ๋ฉด๋œ๋‹ค.

์‚ฌ์šฉํ•˜๋ ค๋ฉด ํŒŒ์ผ์–ธ์–ด๋ฅผ javascript์—์„œ javascript react๋กœ ๋ณ€๊ฒฝํ•ด์ค˜์•ผํ•œ๋‹ค.

ํŒŒ์ผ์ด ์—ด๋ฆฐ ์ƒํƒœ์—์„œ

์šฐ์ธก ํ•˜๋‹จ์— ๋ณด๋ฉด ์‚ฌ์šฉ์ค‘์ธ ์–ธ์–ด๊ฐ€ ๋‚˜์™€์žˆ๋‹ค.

javascript๋กœ ๋˜์–ด์žˆ๋‹ค๋ฉด ํ•ด๋‹น ๋ถ€๋ถ„์„ ํด๋ฆญํ•œ๋‹ค.

 

 

 

 

snippet์„ค์ •์‹œ trigger ๋ฌธ์ž๋ฅผ srfc๋กœ ํ–ˆ์œผ๋‹ˆ

์ด์ œ srfc๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ์—”ํ„ฐ๋ฅผ ๋ˆ„๋ฅด๋ฉด ์ €์žฅํ•œ ์ž๋™์™„์„ฑ์ด ์ œ๋Œ€๋กœ ์ž‘๋™๋˜๋Š”๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

 

 

๋ฐ˜์‘ํ˜•