"Compile System" -> 'Compile New System' and enter the following content.">
The following columnsublime introductory tutorialwill introduce to you how to establish a Node compilation system under Sublime. I hope it will be helpful to friends in need!
Building a Node compilation system under Sublime
What to do
The main points of establishing a compilation system under Node The function is to facilitate the development and debugging of files
How to create
Select "Tools" -> "Compile System" -> 'Compile New System', enter the following content:
{ "cmd": ["node", "$file"], "selector": "source.js" }
Ctrl S Save it as node.sublime-bulid
How to use
Create a test file The content of the server.js file is as follows:
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}`); });
Press the shortcut key Ctrl B to execute file compilation. If the following content is output, it means that the Node compilation system under Sublime is successfully established.
server is running at http://localhost:3000
Press the Esc key to close the compilation box.
Dear friends, here Is it easy to establish a Node compilation system environment under Sublime (^-^)? Give it a try!
The above is the detailed content of Establishing Node compilation system under Sublime. For more information, please follow other related articles on the PHP Chinese website!