Sublime配置编译js脚本

1. 环境安装

首先得有nodejs环境,可以去nodejs官网下载安装。

安装后在cmd输入node -v查看是否安装成功。

2. Sublime配置

sublime中工具->编译系统->新建编译系统填写如下信息

{
    "cmd": ["node", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "working_dir": "${file_path}",
    "selector": "source.js",
    "shell": true,
    "encoding": "utf-8",
    "windows": {
        "cmd": ["node", "$file"]
    },
    "linux": {
        "cmd": ["killall node; node", "$file"]
    }
}

保存为javascript.sublime-build

3. 测试

写一段js,如console.log("hello world");。然后使用快捷键 ctrl + B 查看是否输出hello world内容,输出则配置成功。

如果您觉得本文对您有用,欢迎捐赠或留言~
微信支付
支付宝

发表评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注