๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
IT-Engineering

์œˆ๋„์šฐ(Windows) Visual Studio Code ์›นํŽ˜์ด์ง€ ํ…Œ์ŠคํŠธ์‹œ ํฌ๋กฌ(chrome) ์‹คํ–‰ ํ™˜๊ฒฝ ๋งŒ๋“ค๊ธฐ(tasks.json)

by ๐Ÿงž‍โ™‚๏ธ 2020. 4. 5.
๋ฐ˜์‘ํ˜•

Visual Studio Code์—์„œ HTML/CSS๋‚˜ JavaScript ํ…Œ์ŠคํŠธ๋ฅผ ํ•  ๊ฒฝ์šฐ,

ํฌ๋กฌ(Chrome)์œผ๋กœ ์‹คํ–‰ํ•ด์„œ ๋ฐ”๋กœ ํ…Œ์ŠคํŠธ๋ฅผ ํ•ด๋ณด๊ณ  ์‹ถ์„ ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค.

 

์ƒˆ๋กœ๋งŒ๋“  ํด๋”์—์„œ ์ƒˆ๋กœ์šด htmlํŒŒ์ผ ๋“ฑ์„ ์ž‘์„ฑํ•ด์„œ ํ…Œ์ŠคํŠธํ•˜๊ณ  ์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•˜๊ฒ ๋‹ค.

Ctrl+Shift+B๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ™”๋ฉด์ด ๋œฌ๋‹ค.

Configure Build Task๋ฅผ ๋ˆŒ๋Ÿฌ์ฃผ์ž.

Configure Build Task๋ฅผ ๋ˆ„๋ฅด๋ฉด,

tasks.jsonํŒŒ์ผ์„ ๋งŒ๋“ค์–ด๋ณด์ž.

task.jsonํŒŒ์ผ ์ƒ์„ฑ์„ ๋ˆ„๋ฅด๊ณ ,

์ ๋‹นํ•œ ๊ฒŒ ์—†์–ด๋ณด์ด๋‹ˆ Others๋กœ.

์ ๋‹นํ•œ ๊ฒŒ ์—†์–ด๋ณด์ด๋‹ˆ Others๋ฅผ ๋ˆŒ๋Ÿฌ์ฃผ๋ฉด,

์œ„์™€ ๊ฐ™์ด Hello๋ผ๊ณ  shell์— ์ฐ์–ด์ฃผ๋Š” echo task๊ฐ€ ์ž๋™์œผ๋กœ ์ƒ์„ฑ๋œ๋‹ค.

์ด task.jsonํŒŒ์ผ์„ ์•„๋ž˜์™€ ๊ฐ™์ด ๊ต์ฒดํ•ด์ค€๋‹ค.

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "chrome",
            "type": "process",
            "command": "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",
            "args": [
                "${file}"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

command์— ์žˆ๋Š” ๊ฒฝ๋กœ๋ฅผ ๋ณธ์ธ์˜ chrome๊ฒฝ๋กœ์— ๋งž๊ฒŒ ์กฐ์ •ํ•ด์ฃผ์–ด์•ผ ํ•˜๋Š”๋ฐ ์ฃผ์˜ํ•  ์ ์€

์œˆ๋„์šฐ์˜ \๊ฒฝ๋กœ ๋Œ€์‹  /๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝํ•ด์ค„ ๊ฒƒ!

type์„ shell์—์„œ process๋ฅผ ๋ฐ”๊ฟ”์คฌ๊ณ , args๋ฅผ ํ†ตํ•ด argument(์ธ์ž)๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ์—ˆ๋‹ค๋Š” ๊ฒƒ๋งŒ ์•Œ๋ฉด ๋œ๋‹ค.

extension์„ค์น˜๋กœ๋„ ์ข‹์€ ๋ฐฉ๋ฒ•๋“ค์ด ๋” ์žˆ์œผ๋‚˜ ๊ฐ€์žฅ ์‰ฝ๊ฒŒ ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ• ํ•˜๋‚˜๋ฅผ ์†Œ๊ฐœ ์™„๋ฃŒํ–ˆ์Œ.

๋.

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€