下面由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编译系统环境是不是灰尝简单(^-^), 动手试一下吧!
以上就是sublime下建立node编译系统的详细内容。