"Compile System" -> 'Compile New System' and enter the following content."> Establishing Node compilation system under Sublime-sublime-php.cn

Establishing Node compilation system under Sublime

藏色散人
Release: 2019-10-18 14:02:02
forward
3082 people have browsed it

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!

Establishing Node compilation system under Sublime

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" }
Copy after login

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}`); });
Copy after login

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
Copy after login

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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!