下面由sublime入門教程欄目給大家介紹sublime下建立node編譯系統的方法,希望對需要的朋友有所幫助!
Sublime下建立Node編譯系統
做什么的
在Node下建立編譯系統主要的作用是方便開發調試文件
怎么建立
選擇 “工具” -> “編譯系統” -> ‘編譯新系統’, 輸入如下內容:
{ ????"cmd":?["node",?"$file"], ????"selector":?"source.JS" }
Ctrl + S 保存為node.sublime-bulid 即可
怎么使用
建立測試文件server.js文件內容如下:
const?http?=?require('http'); const?hostname?=?'localhost'; const?port?=?'3000'; const?server?=?http.createServer((req,?res)?=>?{ ????res.writeHead(200,?{'content-type':?'text/plain'}); ????res.end('hello?world'); }); server.listen(port,?hostname,?()?=>?{ ????console.log(`server?is?running?at?http://${hostname}:${port}`); });
按快捷鍵 Ctrl + B 執行文件編譯, 輸出如下內容則說明Sublime下的Node編譯系統建立成功
server?is?running?at?http://localhost:3000
按Esc鍵關閉編譯框
小伙伴們在Sublime下建立Node編譯系統環境是不是灰嘗簡單(^-^), 動手試一下吧!
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END