其实非常简单,配置个编译系统即可。
下载 nodejs
这个网上很多教程的,就不讲了。
安装Babel
$ npm install -g babel
在ST新建编译系统
选择菜单 Tools --> Build System --> new Build System...
中文版的话是 工具 --> 编译系统 --> 新建编译系统...{ "working_dir": "${project_path:${folder}}", "selector": "source.js", "encoding": "utf-8", "shell": true, "windows": { "cmd": ["node", "$file"] }, "osx": { "cmd": ["killall node >/dev/null 2>&1; babel-node $file"] }, "linux": { "cmd": ["killall node >/dev/null 2>&1; babel-node $file"] }}
保存为 javascript.sublime-build,保存位置默认即可。
现在,我们在桌面新建一个 test.js 试试吧,写个简单的测试代码后按 Ctrl + B 或者 F7 运行。转自