Raf*_*off 4 key-bindings npm visual-studio-code
我想使用 webpack 打包保存 js 文件。
这最好使用 webpack watch 来完成。但是无所谓...
下面的答案是我谷歌搜索的结果,我希望在某些时候对某人有用。
Ale*_*lex 11
keybindings.json
{
"key": "ctrl+shift+alt+b",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "npm run test\r"
},
},
Run Code Online (Sandbox Code Playgroud)
使用 npm 在 VSC 中保存时运行 webpack 捆绑……或任何其他您喜欢的 npm 命令,例如编译打字稿。
将一个添加.vscode/tasks.json
到您的项目中:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"command": "npm",
"isShellCommand": true,
"showOutput": "never",
"suppressTaskName": true,
"tasks": [
{
"taskName": "bundle",
"args": ["run", "bundle"],
"isBuildCommand": true,
"showOutput": "never"
}
]
}
Run Code Online (Sandbox Code Playgroud)
编辑keybindings.json
(文件>首选项>键盘快捷键)。
// Place your key bindings in this file to overwrite the defaults
[
{
"key" : "ctrl+s",
"command" : "workbench.action.tasks.build"
}
]
Run Code Online (Sandbox Code Playgroud)
这workbench.action.tasks.build
是一个内置的 vsc 钩子。请参阅此处:https : //code.visualstudio.com/docs/customization/keybindings#_tasks
该任务也可以通过 VSC 访问
Ctrl+P
task
+ 空格 归档时间: |
|
查看次数: |
2608 次 |
最近记录: |